def load_from_input_flags(params, params_source, input_flags):
  """Update params dictionary with input flags.

  Args:
    params: Python dictionary of hyperparameters.
    params_source: Python dictionary to record source of hyperparameters.
    input_flags: All the flags with non-null value of overridden
      hyperparameters.

  Returns:
    Python dict of hyperparameters.
  """
  if params is None:
    raise ValueError(
        'Input dictionary is empty. It is expected to be loaded with default '
        'values')

  if not isinstance(params, dict):
    raise ValueError(
        'The base parameter set must be a Python dict, was: {}'.format(
            type(params)))

  for key in params:
    flag_value = input_flags.get_flag_value(key, None)

    if flag_value is not None:
      params[key] = flag_value
      params_source[key] = 'Command-line flags'

  return params, params_source