code: def _BytesForNonRepeatedElement(value, field_number, field_type):
    
    try:
      fn = type_checkers.TYPE_TO_BYTE_SIZE_FN[field_type]
      return fn(field_number, value)
    except KeyError:
      raise message_mod.EncodeError('Unrecognized field type: %d' % field_type)
docs: Returns the number of bytes needed to serialize a non-repeated element.
    The returned byte count includes space for tag information and any
    other additional space associated with serializing value.
  
    Args:
      value: Value we're serializing.
      field_number: Field number of this value.  (Since the field number
        is stored as part of a varint-encoded tag, this has an impact
        on the total bytes required to serialize the value).
      field_type: The type of the field.  One of the TYPE_* constants
        within FieldDescriptor.