code: def resolve_invite(invite):
      
      from .invite import Invite  # circular import
      if isinstance(invite, Invite) or isinstance(invite, Object):
          return invite.id
      else:
          rx = r'(?:https?\:\/\/)?discord(?:\.gg|app\.com\/invite)\/(.+)'
          m = re.match(rx, invite)
          if m:
              return m.group(1)
      return invite
docs: Resolves an invite from a :class:`Invite`, URL or ID
  
      Parameters
      -----------
      invite: Union[:class:`Invite`, :class:`Object`, :class:`str`]
          The invite.
  
      Returns
      --------
      :class:`str`
          The invite code.