def crc(line):
    """Calculate the cyclic redundancy check (CRC) for a string

    Parameters
    ----------
    line : str, characters to calculate crc
    Returns
    -------
    crc : str, in hex notation
    """
    crc = ord(line[0:1])
    for n in range(1, len(line)-1):
        crc = crc ^ ord(line[n:n+1])
    return '%X' % crc