code: def hash_nanopub(nanopub: Mapping[str, Any]) -> str:
      hash_list = []
      hash_list.append(nanopub["nanopub"]["type"].get("name", "").strip())
      hash_list.append(nanopub["nanopub"]["type"].get("version", "").strip())
      if nanopub["nanopub"]["citation"].get("database", False):
          hash_list.append(
              nanopub["nanopub"]["citation"]["database"].get("name", "").strip()
          )
          hash_list.append(
              nanopub["nanopub"]["citation"]["database"].get("id", "").strip()
          )
      elif nanopub["nanopub"]["citation"].get("uri", False):
          hash_list.append(nanopub["nanopub"]["citation"].get("uri", "").strip())
      elif nanopub["nanopub"]["citation"].get("reference", False):
          hash_list.append(nanopub["nanopub"]["citation"].get("reference", "").strip())
      assertions = []
      for assertion in nanopub["nanopub"]["assertions"]:
          if assertion.get("relation") is None:
              assertion["relation"] = ""
          if assertion.get("object") is None:
              assertion["object"] = ""
          assertions.append(
              " ".join(
                  (
                      assertion["subject"].strip(),
                      assertion.get("relation", "").strip(),
                      assertion.get("object", "").strip(),
                  )
              ).strip()
          )
      assertions = sorted(assertions)
      hash_list.extend(assertions)
      annotations = []
      for anno in nanopub["nanopub"]["annotations"]:
          annotations.append(
              " ".join((anno.get("type", "").strip(), anno.get("id", "").strip())).strip()
          )
      annotations = sorted(annotations)
      hash_list.extend(annotations)
      np_string = " ".join([l.lower() for l in hash_list])
      return "{:x}".format(CityHash64(np_string))