Use getitem magic method instead of getattr

Add the __getitem__ magic method to the VariableWrapper class because the
__getitem__ string inside __getattr__ does not work.

Also fix formating and redundant comment