code: def pubkey(self):
          
          if not self.is_public:
              if self._sibling is None or isinstance(self._sibling, weakref.ref):
                  # create a new key shell
                  pub = PGPKey()
                  pub.ascii_headers = self.ascii_headers.copy()
  
                  # get the public half of the primary key
                  pub._key = self._key.pubkey()
  
                  # get the public half of each subkey
                  for skid, subkey in self.subkeys.items():
                      pub |= subkey.pubkey
  
                  # copy user ids and user attributes
                  for uid in self._uids:
                      pub |= copy.copy(uid)
  
                  # copy signatures that weren't copied with uids
                  for sig in self._signatures:
                      if sig.parent is None:
                          pub |= copy.copy(sig)
  
                  # keep connect the two halves using a weak reference
                  self._sibling = weakref.ref(pub)
                  pub._sibling = weakref.ref(self)
  
              return self._sibling()
          return None
docs: If the :py:obj:`PGPKey` object is a private key, this method returns a corresponding public key object with
          all the trimmings. Otherwise, returns ``None``