def METHOD_NAME(self, d1, d2):
    doc = {}
    # Compute similarty metrics.
    try:
        dout = {}
        l = {}
        v = {}
        for i, li in enumerate(
            [d1["statistics"][self.fp_type], d2["statistics"][self.fp_type]]
        ):
            v[i] = []
            l[i] = []
            # for optype, stats in d.items():
            for opdict in li:
                for stattype, val in opdict.items():
                    if stattype != "name":
                        v[i].append(val)
                        l[i].append("{} {}".format(opdict["name"], stattype))
        if len(l[0]) != len(l[1]):
            raise RuntimeError(
                "Site-fingerprint statistics dictionaries"
                " have different sizes ({}, {})".format(len(l[0]), len(l[1]))
            )
        for k in l[0]:
            if k not in l[1]:
                raise RuntimeError(
                    'Label "{}" not found in second site-'
                    "fingerprint statistics "
                    "dictionary".format(k)
                )
        v1 = np.array([v[0][k] for k in range(len(l[0]))])
        v2 = np.array([v[1][l[1].index(k)] for k in l[0]])
        dout["cos"] = np.dot(v1, v2) / (np.linalg.norm(v1) * np.linalg.norm(v2))
        dout["dist"] = np.linalg.norm(v1 - v2)
        doc = dout
    except Exception as e:
        self.logger.error(
            "Failed calculating structure similarity" "metrics: {}".format(e)
        )
    return doc