code: def to_array(self):
          
          array = super(MessageEntity, self).to_array()
          array['type'] = u(self.type)  # py2: type unicode, py3: type str
  
          array['offset'] = int(self.offset)  # type int
          array['length'] = int(self.length)  # type int
          if self.url is not None:
              array['url'] = u(self.url)  # py2: type unicode, py3: type str
  
          if self.user is not None:
              array['user'] = self.user.to_array()  # type User
  
          return array
docs: Serializes this MessageEntity to a dictionary.
  
          :return: dictionary representation of this object.
          :rtype: dict