Return a list of detailed matches, for the configuration blocks (parent-child
    relationship) whose parent respects the regular expressions configured via
    the ``parent_regex`` argument, and the child matches the ``child_regex``
    regular expression. The result is a list of dictionaries with the following
    keys:

    - ``match``: a boolean value that tells whether ``child_regex`` matched any
      children lines.
    - ``parent``: the parent line (as text).
    - ``child``: the child line (as text). If no child line matched, this field
      will be ``None``.

    Note that the return list contains the elements that matched the parent
    condition, the ``parent_regex`` regular expression. Therefore, the ``parent``
    field will always have a valid value, while ``match`` and ``child`` may
    default to ``False`` and ``None`` respectively when there is not child match.

    CLI Example:

    .. code-block:: bash

        salt '*' ciscoconfparse.filter_lines config_path=https://bit.ly/2mAdq7z parent_regex='Gigabit' child_regex='shutdown'

    Example output (for the example above):

    .. code-block:: python

        [
            {
                'parent': 'interface GigabitEthernet1',
                'match': False,
                'child': None
            },
            {
                'parent': 'interface GigabitEthernet2',
                'match': True,
                'child': ' shutdown'
            },
            {
                'parent': 'interface GigabitEthernet3',
                'match': True,
                'child': ' shutdown'
            }
        ]

def filter_lines(config=None,
                 config_path=None,
                 parent_regex=None,
                 child_regex=None,
                 saltenv='base'):
    '''
    Return a list of detailed matches, for the configuration blocks (parent-child
    relationship) whose parent respects the regular expressions configured via
    the ``parent_regex`` argument, and the child matches the ``child_regex``
    regular expression. The result is a list of dictionaries with the following
    keys:

    - ``match``: a boolean value that tells whether ``child_regex`` matched any
      children lines.
    - ``parent``: the parent line (as text).
    - ``child``: the child line (as text). If no child line matched, this field
      will be ``None``.

    Note that the return list contains the elements that matched the parent
    condition, the ``parent_regex`` regular expression. Therefore, the ``parent``
    field will always have a valid value, while ``match`` and ``child`` may
    default to ``False`` and ``None`` respectively when there is not child match.

    CLI Example:

    .. code-block:: bash

        salt '*' ciscoconfparse.filter_lines config_path=https://bit.ly/2mAdq7z parent_regex='Gigabit' child_regex='shutdown'

    Example output (for the example above):

    .. code-block:: python

        [
            {
                'parent': 'interface GigabitEthernet1',
                'match': False,
                'child': None
            },
            {
                'parent': 'interface GigabitEthernet2',
                'match': True,
                'child': ' shutdown'
            },
            {
                'parent': 'interface GigabitEthernet3',
                'match': True,
                'child': ' shutdown'
            }
        ]
    '''
    ret = []
    ccp = _get_ccp(config=config, config_path=config_path, saltenv=saltenv)
    parent_lines = ccp.find_objects(parent_regex)
    for parent_line in parent_lines:
        child_lines = parent_line.re_search_children(child_regex)
        if child_lines:
            for child_line in child_lines:
                ret.append({
                    'match': True,
                    'parent': parent_line.text,
                    'child': child_line.text
                })
        else:
            ret.append({
                'match': False,
                'parent': parent_line.text,
                'child': None
            })
    return ret