def IsConfigUserInputValid(user_input, valid_el):
  """Determines if user input within configuration scripts is valid.

  Each time a choice is presented to the user, a set of allowed values specific
  to that interaction is passed into this function.

  Args:
    user_input: The string of user input.
    valid_el: A list of valid elements for the current interaction.

  Returns:
    bool True if user input is valid, False otherwise.
  """
  if not user_input: return False

  try:
    valid_el.index(str(user_input))
  except ValueError:
    return False
  return True