Delete an existing pool member.

    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 be modified
    member
        The name of the member to delete from the pool

def delete_pool_member(hostname, username, password, name, member):
    '''
    Delete an existing pool member.

    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 be modified
    member
        The name of the member to delete from the pool
    '''

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

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

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

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

       #what are the current members?
        current_members = existing['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:
            deleted = __salt__['bigip.delete_pool_member'](hostname, username, password, name, member)
            # did we get rid of it?
            if deleted['code'] == 200:
                ret['result'] = True
                ret['comment'] = 'Pool Member: {member} was successfully deleted.'.format(member=member)
                ret['changes']['old'] = existing_member
                ret['changes']['new'] = {}

        # something bad happened
        else:
            ret['result'] = True
            ret['comment'] = 'This pool member already does not exist. No changes made.'
            ret['changes']['old'] = {}
            ret['changes']['new'] = {}

    else:
        ret = _load_result(existing, ret)

    return ret