def cli(self, interface, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command.format(interface=interface))
    else:
        out = output
    result_dict = {}
    p1 = re.compile('^(?P<key>[\\S\\s]+) +is +(?P<value>[\\S\\s]+)$')
    p2 = re.compile('^number +of +lanes +(?P<lanes>[\\d]+)$')
    for line in out.splitlines():
        line = line.strip()
        m = p1.match(line)
        if m:
            group = m.groupdict()
            key = group['key'].strip().replace(' ', '_').lower()
            value = group['value'].strip()
            intf_dict = result_dict.setdefault('interfaces', {}).setdefault(interface, {})
            intf_dict.update({key: value})
            continue
        m = p2.match(line)
        if m:
            intf_dict['number_of_lanes'] = m.groupdict()['lanes']
            continue
    return result_dict
def cli(self, interface, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command.format(interface=interface))
    else:
        out = output
    result_dict = {}
    p1 = re.compile('^(?P<key>[\\S\\s]+) +is +(?P<value>[\\S\\s]+)$')
    p2 = re.compile('^number +of +lanes +(?P<lanes>[\\d]+)$')
    for line in out.splitlines():
        line = line.strip()
        m = p1.match(line)
        if m:
            group = m.groupdict()
            key = group['key'].strip().replace(' ', '_').lower()
            value = group['value'].strip()
            intf_dict = result_dict.setdefault('interfaces', {}).setdefault(interface, {})
            intf_dict.update({key: value})
            continue
        m = p2.match(line)
        if m:
            intf_dict['number_of_lanes'] = m.groupdict()['lanes']
            continue
    return result_dict