<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_postgresql_args(db_config, extra_args=None):
 """ Returns an array of argument values that will be passed to a `psql` or `pg_dump` process when it is started based on the given database configuration. """

    db = db_config['NAME']

    mapping = [('--username={0}', db_config.get('USER')),
               ('--host={0}', db_config.get('HOST')),
               ('--port={0}', db_config.get('PORT'))]
    args = apply_arg_values(mapping)

    if extra_args is not None:
        args.extend(shlex.split(extra_args))
    args.append(db)

    return args