<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def modify_pool_member(hostname, username, password, name, member,
                       connection_limit=None,
                       description=None,
                       dynamic_ratio=None,
                       inherit_profile=None,
                       logging=None,
                       monitor=None,
                       priority_group=None,
                       profiles=None,
                       rate_limit=None,
                       ratio=None,
                       session=None,
                       member_state=None):
    '''
    A function to connect to a bigip device and modify a member of an existing 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 modify
    member
        The member modify
    connection_limit
        [integer]
    description
        [string]
    dynamic_ratio
        [integer]
    inherit_profile
        [enabled | disabled]
    logging
        [enabled | disabled]
    monitor
        [name]
    priority_group
        [integer]
    profiles
        [none | profile_name]
    rate_limit
        [integer]
    ratio
        [integer]
    session
        [user-enabled | user-disabled]
    member_state (state)
        [ user-up | user-down ]

    '''

    ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}

    if __opts__['test']:
        return _test_output(ret, 'modify', params={
            'hostname': hostname,
            'username': username,
            'password': password,
            'name': name,
            'members': member
        }
        )

    #is this pool member currently configured?
    existing_pool = __salt__['bigip.list_pool'](hostname, username, password, name)

    if existing_pool['code'] == 200:

        # for some reason iControl REST doesn't support listing a single pool member.
        # the response from GET for listing a member will return 200 even if it doesn't exists.
        # because of this we have to do some rather "unnecessary" searching within a pool.

        #what are the current members?
        current_members = existing_pool['content']['membersReference']['items']

        #loop through them
        exists = False
        for current_member in current_members:
            if current_member['name'] == member:
                exists = True
                existing_member = current_member
                break

        if exists:

            #modify the pool member
            modified = __salt__['bigip.modify_pool_member'](hostname=hostname,
                                                            username=username,
                                                            password=password,
                                                            name=name,
                                                            member=member,
                                                            connection_limit=connection_limit,
                                                            description=description,
                                                            dynamic_ratio=dynamic_ratio,
                                                            inherit_profile=inherit_profile,
                                                            logging=logging,
                                                            monitor=monitor,
                                                            priority_group=priority_group,
                                                            profiles=profiles,
                                                            rate_limit=rate_limit,
                                                            ratio=ratio,
                                                            session=session,
                                                            state=member_state)

            #re-list the pool
            new_pool = __salt__['bigip.list_pool'](hostname, username, password, name)

            if modified['code'] == 200 and modified['code'] == 200:

                #what are the new members?
                new_members = new_pool['content']['membersReference']['items']

                #loop through them
                for new_member in new_members:
                    if new_member['name'] == member:
                        modified_member = new_member
                        break

                #check for changes
                old = {'content': existing_member}
                new = {'content': modified_member}
                ret = _check_for_changes('Pool Member: {member}'.format(member=member), ret, old, new)

            else:
                ret = _load_result(modified, ret)
        else:
            ret['comment'] = 'Member: {name} does not exists within this pool.  No changes made.'.format(name=member['name'])

    #pool does not exists
    elif existing_pool['code'] == 404:
        ret['comment'] = 'A pool with this name was not found.'
    else:
        ret = _load_result(existing_pool, ret)

    return ret