from functools import reduce
import operator


def validate_nmea_checksum(sentence):
    """
    Validates NMEA sentence using checksum according to the standard.

    :param sentence: NMEA sentence including checksum
    :returns:
       - Boolean result (checksum correct)
       - raw NMEA data string, with prefix $Gx and checksum suffix removed

    """
    sentence = sentence.strip('\n').strip('\r')
    nmeadata, cksum = sentence.split('*', 1)
    nmeadata = nmeadata.replace('$', '')
    xcksum = str("%0.2x" % (reduce(operator.xor, (ord(c) for c in nmeadata), 0))).upper()
    return (cksum == xcksum), nmeadata[2:]