import binascii


def compute_crc(buf, crc_so_far=0):
    """
    :param buf: bytes to compute CRC over.

    :param crc_so_far: value of CRC of bytes seen so far.  To compute
    the CRC over multiple buffers, pass the previous buffer's CRC as
    *crc_so_far*.  Use 0 (default) for the first time.

    :returns: CRC value.
    """
    return binascii.crc32(buf, crc_so_far) & 0xFFffFFff