<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _LogInvalidRunLevels(states, valid):
 """Log any invalid run states found."""

  invalid = set()
  for state in states:
    if state not in valid:
      invalid.add(state)
  if invalid:
    logging.warning("Invalid init runlevel(s) encountered: %s",
                    ", ".join(invalid))