def _checksum_valid(line):
    """
    Calculate the checksum of the GPS output and check if it is equal to
    the provided checksum in output; therefore - there was no
    transmission errors.

    The checksum is XOR of all bytes between $ and * characters
    (excluding themselves).

    :param line: line of output to check
    :type line: str
    :return: True if the output is valid; False otherwise
    :rtype: bool
    """
    l = line.index('$')
    r = line.rindex('*')
    chksum = 0
    for char in line[l + 1: r]:
        chksum ^= ord(char)
    if line[r + 1: r + 3] == '%.2X' % chksum:
        return True
    return False