code: def _getfield(self, block, name):
          
  
          # First, get the field from the class, if defined
          block_field = getattr(block.__class__, name, None)
          if block_field is not None and isinstance(block_field, Field):
              return block_field
  
          # Not in the class, so name
          # really doesn't name a field
          raise KeyError(name)
docs: Return the field with the given `name` from `block`.
          If no field with `name` exists in any namespace, raises a KeyError.
  
          :param block: xblock to retrieve the field from
          :type block: :class:`~xblock.core.XBlock`
          :param name: name of the field to retrieve
          :type name: str
          :raises KeyError: when no field with `name` exists in any namespace