def checksum(command):
    """Function to calculate checksum as per Satel manual."""
    crc = 5242
    for b in command:
        crc = crc << 1 & 65535 | (crc & 32768) >> 15
        crc = crc ^ 65535
        crc = crc + (crc >> 8) + b & 65535
    return crc
