@staticmethod
def parse_line(item, nodes=None):
    '\n        Parse and validate a line as returned by alfred.\n\n        Such lines consist of a nodes MAC address and an escaped string of JSON\n        encoded data. Note that most missing fields are populated with\n        reasonable defaults.\n        '
    if (nodes is None):
        nodes = {}
    if ((item[(- 2):] != '},') or (item[0] != '{')):
        raise ValueError('malformatted line: {0}'.format(item))
    (mac, properties) = item[1:(- 2)].split(',', 1)
    mac = AlfredParser._parse_string(mac.strip())
    jsonschema.validate(mac, AlfredParser.MAC_SCHEMA)
    properties = AlfredParser._parse_string(properties.strip())
    if ('\x00' in properties):
        decompress = zlib.decompressobj((zlib.MAX_WBITS | 32))
        properties = decompress.decompress(properties.encode('raw-unicode-escape'), (64 * 1024)).decode('utf-8')
    else:
        properties = properties.encode('latin-1').decode('utf8')
    properties = json.loads(properties)
    jsonschema.validate(properties, AlfredParser.ALFRED_NODE_SCHEMA)
    properties.setdefault('downstream_mbps_wan', 0)
    properties.setdefault('downstream_mbps_ff', 0)
    properties.setdefault('rx_bytes', 0)
    properties.setdefault('tx_bytes', 0)
    if (mac in nodes):
        node = nodes[mac]
        node.update_properties(properties, True)
        node.online = True
        node.lastseen = NOW_TIMESTAMP
    else:
        node = Node(mac, properties, True)
        nodes[mac] = node
Parse and validate a line as returned by alfred.

Such lines consist of a nodes MAC address and an escaped string of JSON
encoded data. Note that most missing fields are populated with
reasonable defaults.
@staticmethod
def parse_line(item, nodes=None):
    '\n        Parse and validate a line as returned by alfred.\n\n        Such lines consist of a nodes MAC address and an escaped string of JSON\n        encoded data. Note that most missing fields are populated with\n        reasonable defaults.\n        '
    if (nodes is None):
        nodes = {}
    if ((item[(- 2):] != '},') or (item[0] != '{')):
        raise ValueError('malformatted line: {0}'.format(item))
    (mac, properties) = item[1:(- 2)].split(',', 1)
    mac = AlfredParser._parse_string(mac.strip())
    jsonschema.validate(mac, AlfredParser.MAC_SCHEMA)
    properties = AlfredParser._parse_string(properties.strip())
    if ('\x00' in properties):
        decompress = zlib.decompressobj((zlib.MAX_WBITS | 32))
        properties = decompress.decompress(properties.encode('raw-unicode-escape'), (64 * 1024)).decode('utf-8')
    else:
        properties = properties.encode('latin-1').decode('utf8')
    properties = json.loads(properties)
    jsonschema.validate(properties, AlfredParser.ALFRED_NODE_SCHEMA)
    properties.setdefault('downstream_mbps_wan', 0)
    properties.setdefault('downstream_mbps_ff', 0)
    properties.setdefault('rx_bytes', 0)
    properties.setdefault('tx_bytes', 0)
    if (mac in nodes):
        node = nodes[mac]
        node.update_properties(properties, True)
        node.online = True
        node.lastseen = NOW_TIMESTAMP
    else:
        node = Node(mac, properties, True)
        nodes[mac] = node