code: def _key_from_filepath(self, filename, klass, password):
          
          cert_suffix = "-cert.pub"
          # Assume privkey, not cert, by default
          if filename.endswith(cert_suffix):
              key_path = filename[: -len(cert_suffix)]
              cert_path = filename
          else:
              key_path = filename
              cert_path = filename + cert_suffix
          # Blindly try the key path; if no private key, nothing will work.
          key = klass.from_private_key_file(key_path, password)
          # TODO: change this to 'Loading' instead of 'Trying' sometime; probably
          # when #387 is released, since this is a critical log message users are
          # likely testing/filtering for (bah.)
          msg = "Trying discovered key {} in {}".format(
              hexlify(key.get_fingerprint()), key_path
          )
          self._log(DEBUG, msg)
          # Attempt to load cert if it exists.
          if os.path.isfile(cert_path):
              key.load_certificate(cert_path)
              self._log(DEBUG, "Adding public certificate {}".format(cert_path))
          return key
docs: Attempt to derive a `.PKey` from given string path ``filename``:
  
          - If ``filename`` appears to be a cert, the matching private key is
            loaded.
          - Otherwise, the filename is assumed to be a private key, and the
            matching public cert will be loaded if it exists.