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

def manage_pool_members(hostname, username, password, name, members):
    '''
    Manage the members of an existing pool.  This function replaces all current pool members.
    Only the parameters specified are enforced.

    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
    members
        list of pool members to manage.

    '''

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

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

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

    # if it exists
    if existing['code'] == 200:

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

        modified = __salt__['bigip.replace_pool_members'](hostname, username, password, name, members)

        #was the modification successful?
        if modified['code'] == 200:

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

            #just in case something happened...
            if new_listing['code'] != 200:
                ret = _load_result(new_listing, ret)
                ret['comment'] = 'modification of the pool was successful but an error occurred upon retrieving new' \
                                 ' listing.'
                return ret

            new_members = new_listing['content']['membersReference']['items']

            #remove generation keys and create new lists indexed by integers
            for current_member in current_members:
                del current_member['generation']

            for new_member in new_members:
                del new_member['generation']

            #anything changed?
            ret = _check_for_changes('Pool Membership', ret, current_members, new_members)

        else:
            ret = _load_result(modified, ret)

    #pool does not exists
    elif existing['code'] == 404:
        ret['comment'] = 'A pool with this name was not found.'

    else:
        ret = _load_result(existing, ret)

    return ret