检查数据的校验和
    :param buf:
    :type buf:
    :param csum:
    :type csum:
    :return:
    :rtype:

def check_sum(buf, csum):
    """
    检查数据的校验和
    :param buf:
    :type buf:
    :param csum:
    :type csum:
    :return:
    :rtype:
    """
    csum = csum.encode('utf-8')
    _csum = ord(buf[0])
    for x in buf[1:]:
        _csum ^= ord(x)

    _csum = binascii.b2a_hex(chr(_csum).encode('utf-8')).upper()
    if _csum != csum:
        sys.stderr.write('csum not matched: ({} {})\n'.format(_csum, csum))
    return _csum == csum