code: def _Encode(self, value):
      
      try:
        return value.SerializeToString().encode("hex")
      except AttributeError:
        if isinstance(value, (int, long)):
          return str(value).encode("hex")
        else:
          # Types "string" and "bytes" are stored as strings here.
          return utils.SmartStr(value).encode("hex")
docs: Encode the value for the attribute.