<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _getfield(self, block, name):
 """ 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 """


        # 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)