A function to connect to a bigip device and create a pool.

    hostname
        The host/address of the bigip device
    username
        The iControl REST username
    password
        The iControl REST password
    name
        The name of the pool to create.
    members
        List of comma delimited pool members to add to the pool.
        i.e. 10.1.1.1:80,10.1.1.2:80,10.1.1.3:80
    allow_nat
        [yes | no]
    allow_snat
        [yes | no]
    description
        [string]
    gateway_failsafe_device
        [string]
    ignore_persisted_weight
        [enabled | disabled]
    ip_tos_to_client
        [pass-through | [integer]]
    ip_tos_to_server
        [pass-through | [integer]]
    link_qos_to_client
        [pass-through | [integer]]
    link_qos_to_server
        [pass-through | [integer]]
    load_balancing_mode
        [dynamic-ratio-member | dynamic-ratio-node |
        fastest-app-response | fastest-node |
        least-connections-members |
        least-connections-node |
        least-sessions |
        observed-member | observed-node |
        predictive-member | predictive-node |
        ratio-least-connections-member |
        ratio-least-connections-node |
        ratio-member | ratio-node | ratio-session |
        round-robin | weighted-least-connections-member |
        weighted-least-connections-node]
    min_active_members
        [integer]
    min_up_members
        [integer]
    min_up_members_action
        [failover | reboot | restart-all]
    min_up_members_checking
        [enabled | disabled]
    monitor
        [name]
    profiles
        [none | profile_name]
    queue_depth_limit
        [integer]
    queue_on_connection_limit
        [enabled | disabled]
    queue_time_limit
        [integer]
    reselect_tries
        [integer]
    service_down_action
        [drop | none | reselect | reset]
    slow_ramp_time
        [integer]

    CLI Example::

        salt '*' bigip.create_pool bigip admin admin my-pool 10.1.1.1:80,10.1.1.2:80,10.1.1.3:80 monitor=http

def create_pool(hostname, username, password, name, members=None,
                allow_nat=None,
                allow_snat=None,
                description=None,
                gateway_failsafe_device=None,
                ignore_persisted_weight=None,
                ip_tos_to_client=None,
                ip_tos_to_server=None,
                link_qos_to_client=None,
                link_qos_to_server=None,
                load_balancing_mode=None,
                min_active_members=None,
                min_up_members=None,
                min_up_members_action=None,
                min_up_members_checking=None,
                monitor=None,
                profiles=None,
                queue_depth_limit=None,
                queue_on_connection_limit=None,
                queue_time_limit=None,
                reselect_tries=None,
                service_down_action=None,
                slow_ramp_time=None):
    '''
    A function to connect to a bigip device and create a pool.

    hostname
        The host/address of the bigip device
    username
        The iControl REST username
    password
        The iControl REST password
    name
        The name of the pool to create.
    members
        List of comma delimited pool members to add to the pool.
        i.e. 10.1.1.1:80,10.1.1.2:80,10.1.1.3:80
    allow_nat
        [yes | no]
    allow_snat
        [yes | no]
    description
        [string]
    gateway_failsafe_device
        [string]
    ignore_persisted_weight
        [enabled | disabled]
    ip_tos_to_client
        [pass-through | [integer]]
    ip_tos_to_server
        [pass-through | [integer]]
    link_qos_to_client
        [pass-through | [integer]]
    link_qos_to_server
        [pass-through | [integer]]
    load_balancing_mode
        [dynamic-ratio-member | dynamic-ratio-node |
        fastest-app-response | fastest-node |
        least-connections-members |
        least-connections-node |
        least-sessions |
        observed-member | observed-node |
        predictive-member | predictive-node |
        ratio-least-connections-member |
        ratio-least-connections-node |
        ratio-member | ratio-node | ratio-session |
        round-robin | weighted-least-connections-member |
        weighted-least-connections-node]
    min_active_members
        [integer]
    min_up_members
        [integer]
    min_up_members_action
        [failover | reboot | restart-all]
    min_up_members_checking
        [enabled | disabled]
    monitor
        [name]
    profiles
        [none | profile_name]
    queue_depth_limit
        [integer]
    queue_on_connection_limit
        [enabled | disabled]
    queue_time_limit
        [integer]
    reselect_tries
        [integer]
    service_down_action
        [drop | none | reselect | reset]
    slow_ramp_time
        [integer]

    CLI Example::

        salt '*' bigip.create_pool bigip admin admin my-pool 10.1.1.1:80,10.1.1.2:80,10.1.1.3:80 monitor=http
    '''

    params = {
        'description': description,
        'gateway-failsafe-device': gateway_failsafe_device,
        'ignore-persisted-weight': ignore_persisted_weight,
        'ip-tos-to-client': ip_tos_to_client,
        'ip-tos-to-server': ip_tos_to_server,
        'link-qos-to-client': link_qos_to_client,
        'link-qos-to-server': link_qos_to_server,
        'load-balancing-mode': load_balancing_mode,
        'min-active-members': min_active_members,
        'min-up-members': min_up_members,
        'min-up-members-action': min_up_members_action,
        'min-up-members-checking': min_up_members_checking,
        'monitor': monitor,
        'profiles': profiles,
        'queue-on-connection-limit': queue_on_connection_limit,
        'queue-depth-limit': queue_depth_limit,
        'queue-time-limit': queue_time_limit,
        'reselect-tries': reselect_tries,
        'service-down-action': service_down_action,
        'slow-ramp-time': slow_ramp_time
    }

    # some options take yes no others take true false.  Figure out when to use which without
    # confusing the end user
    toggles = {
        'allow-nat': {'type': 'yes_no', 'value': allow_nat},
        'allow-snat': {'type': 'yes_no', 'value': allow_snat}
    }

    #build payload
    payload = _loop_payload(params)
    payload['name'] = name

    #determine toggles
    payload = _determine_toggles(payload, toggles)

    #specify members if provided
    if members is not None:
        payload['members'] = _build_list(members, 'ltm:pool:members')

    #build session
    bigip_session = _build_session(username, password)

    #post to REST
    try:
        response = bigip_session.post(
            BIG_IP_URL_BASE.format(host=hostname) + '/ltm/pool',
            data=salt.utils.json.dumps(payload)
        )
    except requests.exceptions.ConnectionError as e:
        return _load_connection_error(hostname, e)

    return _load_response(response)