code: def decode_field(self, field, value):
          
          if isinstance(field, messages.EnumField):
              try:
                  return field.type(value)
              except TypeError:
                  raise messages.DecodeError(
                      'Invalid enum value "%s"' % (value or ''))
  
          elif isinstance(field, messages.BytesField):
              try:
                  return base64.b64decode(value)
              except (binascii.Error, TypeError) as err:
                  raise messages.DecodeError('Base64 decoding error: %s' % err)
  
          elif isinstance(field, message_types.DateTimeField):
              try:
                  return util.decode_datetime(value)
              except ValueError as err:
                  raise messages.DecodeError(err)
  
          elif (isinstance(field, messages.MessageField) and
                issubclass(field.type, messages.Message)):
              return self.__decode_dictionary(field.type, value)
  
          elif (isinstance(field, messages.FloatField) and
                isinstance(value, (six.integer_types, six.string_types))):
              try:
                  return float(value)
              except:  # pylint:disable=bare-except
                  pass
  
          elif (isinstance(field, messages.IntegerField) and
                isinstance(value, six.string_types)):
              try:
                  return int(value)
              except:  # pylint:disable=bare-except
                  pass
  
          return value
docs: Decode a JSON value to a python value.
  
          Args:
            field: A ProtoRPC field instance.
            value: A serialized JSON value.
  
          Return:
            A Python value compatible with field.