# Path: pyeapi/utils.py
# def make_iterable(value):
#     """Converts the supplied value to a list object
# 
#     This function will inspect the supplied value and return an
#     iterable in the form of a list.
# 
#     Args:
#         value (object): An valid Python object
# 
#     Returns:
#         An iterable object of type list
#     """
#     if sys.version_info <= (3, 0):
#         # Convert unicode values to strings for Python 2
#         if isinstance(value, unicode):
#             value = str(value)
#     if isinstance(value, str) or isinstance(value, dict):
#         value = [value]
# 
#     if sys.version_info <= (3, 3):
#         if not isinstance(value, collections.Iterable):
#             raise TypeError('value must be an iterable object')
#     else:
#         if not isinstance(value, collections.abc.Iterable):
#             raise TypeError('value must be an iterable object')
# 
#     return value


import re
import netaddr
from collections import namedtuple
from pyeapi.api import Entity, EntityCollection
from pyeapi.utils import make_iterable
        match = re.search(r'^router bgp (\d+)', config)
        return dict(bgp_as=int(match.group(1)))

    def _parse_router_id(self, config):
        match = re.search(r'router-id ([^\s]+)', config)
        value = match.group(1) if match else None
        return dict(router_id=value)

    def _parse_max_paths(self, config):
        match = re.search(r'maximum-paths\s+(\d+)\s+ecmp\s+(\d+)', config)
        paths = int(match.group(1)) if match else None
        ecmp_paths = int(match.group(2)) if match else None
        return dict(maximum_paths=paths, maximum_ecmp_paths=ecmp_paths)

    def _parse_shutdown(self, config):
        value = 'no shutdown' in config
        return dict(shutdown=not value)

    def _parse_networks(self, config):
        networks = list()
        regexp = r'network (.+)/(\d+)(?: route-map (\w+))*'
        matches = re.findall(regexp, config)
        for (prefix, mask, rmap) in matches:
            rmap = None if rmap == '' else rmap
            networks.append(dict(prefix=prefix, masklen=mask, route_map=rmap))
        return dict(networks=networks)

    def configure_bgp(self, cmd):
        config = self.get()
        cmds = ['router bgp {}'.format(config['bgp_as'])]

# Path: pyeapi/utils.py
# def make_iterable(value):
#     """Converts the supplied value to a list object
# 
#     This function will inspect the supplied value and return an
#     iterable in the form of a list.
# 
#     Args:
#         value (object): An valid Python object
# 
#     Returns:
#         An iterable object of type list
#     """
#     if sys.version_info <= (3, 0):
#         # Convert unicode values to strings for Python 2
#         if isinstance(value, unicode):
#             value = str(value)
#     if isinstance(value, str) or isinstance(value, dict):
#         value = [value]
# 
#     if sys.version_info <= (3, 3):
#         if not isinstance(value, collections.Iterable):
#             raise TypeError('value must be an iterable object')
#     else:
#         if not isinstance(value, collections.abc.Iterable):
#             raise TypeError('value must be an iterable object')
# 
#     return value


# Path: pyeapi/api/bgp.py
import re
import netaddr
from collections import namedtuple
from pyeapi.api import Entity, EntityCollection
from pyeapi.utils import make_iterable

        match = re.search(r'^router bgp (\d+)', config)
        return dict(bgp_as=int(match.group(1)))

    def _parse_router_id(self, config):
        match = re.search(r'router-id ([^\s]+)', config)
        value = match.group(1) if match else None
        return dict(router_id=value)

    def _parse_max_paths(self, config):
        match = re.search(r'maximum-paths\s+(\d+)\s+ecmp\s+(\d+)', config)
        paths = int(match.group(1)) if match else None
        ecmp_paths = int(match.group(2)) if match else None
        return dict(maximum_paths=paths, maximum_ecmp_paths=ecmp_paths)

    def _parse_shutdown(self, config):
        value = 'no shutdown' in config
        return dict(shutdown=not value)

    def _parse_networks(self, config):
        networks = list()
        regexp = r'network (.+)/(\d+)(?: route-map (\w+))*'
        matches = re.findall(regexp, config)
        for (prefix, mask, rmap) in matches:
            rmap = None if rmap == '' else rmap
            networks.append(dict(prefix=prefix, masklen=mask, route_map=rmap))
        return dict(networks=networks)

    def configure_bgp(self, cmd):
        config = self.get()
        cmds = ['router bgp {}'.format(config['bgp_as'])]

        cmds.extend(make_iterable(cmd))