code: def getitem(self, obj, argument):
          
          try:
              return obj[argument]
          except (TypeError, LookupError):
              if isinstance(argument, basestring):
                  try:
                      attr = str(argument)
                  except:
                      pass
                  else:
                      try:
                          value = getattr(obj, attr)
                      except AttributeError:
                          pass
                      else:
                          if self.is_safe_attribute(obj, argument, value):
                              return value
                          return self.unsafe_undefined(obj, argument)
          return self.undefined(obj=obj, name=argument)
docs: Subscribe an object from sandboxed code.