Use this method to get the InputPeer of a known peer_id.

        This is a utility method intended to be used **only** when working with Raw Functions (i.e: a Telegram API
        method you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an
        InputPeer type is required.

        Args:
            peer_id (``int`` | ``str``):
                The peer id you want to extract the InputPeer from.
                Can be a direct id (int), a username (str) or a phone number (str).

        Returns:
            On success, the resolved peer id is returned in form of an InputPeer object.

        Raises:
            :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
            ``KeyError`` in case the peer doesn't exist in the internal database.

def resolve_peer(self,
                     peer_id: Union[int, str]):
        """Use this method to get the InputPeer of a known peer_id.

        This is a utility method intended to be used **only** when working with Raw Functions (i.e: a Telegram API
        method you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an
        InputPeer type is required.

        Args:
            peer_id (``int`` | ``str``):
                The peer id you want to extract the InputPeer from.
                Can be a direct id (int), a username (str) or a phone number (str).

        Returns:
            On success, the resolved peer id is returned in form of an InputPeer object.

        Raises:
            :class:`RPCError <pyrogram.RPCError>` in case of a Telegram RPC error.
            ``KeyError`` in case the peer doesn't exist in the internal database.
        """
        try:
            return self.peers_by_id[peer_id]
        except KeyError:
            if type(peer_id) is str:
                if peer_id in ("self", "me"):
                    return types.InputPeerSelf()

                peer_id = re.sub(r"[@+\s]", "", peer_id.lower())

                try:
                    int(peer_id)
                except ValueError:
                    if peer_id not in self.peers_by_username:
                        self.send(
                            functions.contacts.ResolveUsername(
                                username=peer_id
                            )
                        )

                    return self.peers_by_username[peer_id]
                else:
                    try:
                        return self.peers_by_phone[peer_id]
                    except KeyError:
                        raise PeerIdInvalid

            if peer_id > 0:
                self.fetch_peers(
                    self.send(
                        functions.users.GetUsers(
                            id=[types.InputUser(user_id=peer_id, access_hash=0)]
                        )
                    )
                )
            else:
                if str(peer_id).startswith("-100"):
                    self.send(
                        functions.channels.GetChannels(
                            id=[types.InputChannel(channel_id=int(str(peer_id)[4:]), access_hash=0)]
                        )
                    )
                else:
                    self.send(
                        functions.messages.GetChats(
                            id=[-peer_id]
                        )
                    )

            try:
                return self.peers_by_id[peer_id]
            except KeyError:
                raise PeerIdInvalid