def parse_ltv_packet(packet):
    """Parse a tag-length-value style beacon packet."""
    try:
        frame = LTVFrame.parse(packet)
        for ltv in frame:
            if ltv['type'] == SERVICE_DATA_TYPE:
                data = ltv['value']

                if data["service_identifier"] == EDDYSTONE_UUID:
                    return parse_eddystone_service_data(data)

                elif data["service_identifier"] == ESTIMOTE_UUID:
                    return parse_estimote_service_data(data)

    except ConstructError:
        return None

    return None
def parse_ltv_packet ( packet ) : try : frame = LTVFrame . parse ( packet ) for ltv in frame : if ltv [ 'type' ] == SERVICE_DATA_TYPE : data = ltv [ 'value' ] if data [ "service_identifier" ] == EDDYSTONE_UUID : return parse_eddystone_service_data ( data ) elif data [ "service_identifier" ] == ESTIMOTE_UUID : return parse_estimote_service_data ( data ) except ConstructError : return None return None
Parse a tag-length-value style beacon packet.