.. versionadded:: 2017.7.0

    Update the named lambda function to the configuration.

    Environment
        The parent object that contains your environment's configuration
        settings. This is a dictionary of the form:

        .. code-block:: python

            {
                'Variables': {
                    'VariableName': 'VariableValue'
                }
            }

    Returns ``{'updated': True}`` if the function was updated, and
    ``{'updated': False}`` if the function was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.update_function_config my_function my_role my_file.my_function "my lambda function"

def update_function_config(FunctionName, Role=None, Handler=None,
                           Description=None, Timeout=None, MemorySize=None,
                           region=None, key=None, keyid=None, profile=None,
                           VpcConfig=None, WaitForRole=False, RoleRetries=5,
                           Environment=None):
    '''
    .. versionadded:: 2017.7.0

    Update the named lambda function to the configuration.

    Environment
        The parent object that contains your environment's configuration
        settings. This is a dictionary of the form:

        .. code-block:: python

            {
                'Variables': {
                    'VariableName': 'VariableValue'
                }
            }

    Returns ``{'updated': True}`` if the function was updated, and
    ``{'updated': False}`` if the function was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_lamba.update_function_config my_function my_role my_file.my_function "my lambda function"

    '''

    args = dict(FunctionName=FunctionName)
    options = {'Handler': Handler,
               'Description': Description,
               'Timeout': Timeout,
               'MemorySize': MemorySize,
               'VpcConfig': VpcConfig,
               'Environment': Environment}

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    for val, var in six.iteritems(options):
        if var:
            args[val] = var
    if Role:
        args['Role'] = _get_role_arn(Role, region, key, keyid, profile)
    if VpcConfig:
        args['VpcConfig'] = _resolve_vpcconfig(VpcConfig, region=region, key=key, keyid=keyid, profile=profile)
    try:
        if WaitForRole:
            retrycount = RoleRetries
        else:
            retrycount = 1
        for retry in range(retrycount, 0, -1):
            try:
                r = conn.update_function_configuration(**args)
            except ClientError as e:
                if retry > 1 and e.response.get('Error', {}).get('Code') == 'InvalidParameterValueException':
                    log.info(
                        'Function not updated but IAM role may not have propagated, will retry')
                    # exponential backoff
                    time.sleep((2 ** (RoleRetries - retry)) +
                               (random.randint(0, 1000) / 1000))
                    continue
                else:
                    raise
            else:
                break
        if r:
            keys = ('FunctionName', 'Runtime', 'Role', 'Handler', 'CodeSha256',
                    'CodeSize', 'Description', 'Timeout', 'MemorySize',
                    'FunctionArn', 'LastModified', 'VpcConfig', 'Environment')
            return {'updated': True, 'function': dict([(k, r.get(k)) for k in keys])}
        else:
            log.warning('Function was not updated')
            return {'updated': False}
    except ClientError as e:
        return {'updated': False, 'error': __utils__['boto3.get_error'](e)}