def bsdchecksum(infile):
    """Compute BSD checksum as defined by https://en.wikipedia.org/wiki/BSD_checksum

    :param infile: File location to query
    :type infile: filepath

    :return: Calculated checksum
    :rtype: str
    """
    with open(infile, "rb", buffering=5) as f:
        checksum = 0
        byte = f.read(1)
        while byte:
            checksum = (checksum >> 1) + ((checksum & 1) << 15)
            checksum += int.from_bytes(byte, byteorder="big")
            checksum &= 0xFFFF
            byte = f.read(1)
    return str(checksum)