def METHOD_NAME(self, new_values, profile_name):
    # The access_key/secret_key are now *always* written to the shared
    # credentials file (~/.aws/credentials), see aws/aws-cli#847.
    # post-conditions: ~/.aws/credentials will have the updated credential
    # file values and new_values will have the cred vars removed.
    credential_file_values = {}
    if 'aws_access_key_id' in new_values:
        credential_file_values['aws_access_key_id'] = new_values.pop(
            'aws_access_key_id')
    if 'aws_secret_access_key' in new_values:
        credential_file_values['aws_secret_access_key'] = new_values.pop(
            'aws_secret_access_key')
    if credential_file_values:
        if profile_name is not None:
            credential_file_values['__section__'] = profile_name
        shared_credentials_filename = os.path.expanduser(
            self._session.get_config_variable('credentials_file'))
        self._config_writer.update_config(
            credential_file_values,
            shared_credentials_filename)