

def assert_fingerprint(cert, fingerprint):
    '\n    Checks if given fingerprint matches the supplied certificate.\n\n    :param cert:\n        Certificate as bytes object.\n    :param fingerprint:\n        Fingerprint as string of hexdigits, can be interspersed by colons.\n    '
    hashfunc_map = {
        16: md5,
        20: sha1,
    }
    fingerprint = fingerprint.replace(':', '').lower()
    (digest_length, rest) = divmod(len(fingerprint), 2)
    if (rest or (digest_length not in fingerprint)):
        raise SSLError('Fingerprint is of invalid length.')
    fingerprint_bytes = unhexlify(fingerprint.encode())
    hashfunc = hashfunc_map[digest_length]
    cert_digest = hashfunc(cert).digest()
    if (not (cert_digest == fingerprint_bytes)):
        raise SSLError('Fingerprints did not match. Expected "{0}", got "{1}".'.format(hexlify(fingerprint_bytes), hexlify(cert_digest)))

dataset/ETHPy150Open Bolton-and-Menk-GIS/restapi/restapi/requests/packages/urllib3/util.py assert_fingerprint/VarMisuse@69/153 `hashfunc_map`->`fingerprint`