in vim, you can also use ">>" command which indents a line. if you use python, your vim is probably already set up to indent four spaces, so the above can be done with "4>>" (=indent next four lines)
One of the few times I find myself in visual mode is when I'm indenting lines. v{motion}>> or <<. Super useful.
Edit your code block over at the left margin as you would normally edit any code. Then do a block insert of 4 spaces down the left side of your code block. That's how I do it.
In vim, after editing your code like you usually would: I did exactly that to create the above two blocks.