def _FlattenList(l):
  """Flattens lists of lists into plain lists, recursively.

  For example, [[4, 5, 6], [7, 8], []] will become [4, 5, 6, 7, 8].

  Non-list elements will get wrapped in a list, so 'foo' becomes ['foo'].
  None becomes [].

  Args:
    l: a list, or not.

  Returns:
    A flattened list.
  """
  ret = []
  if l is None:
    pass
  elif not isinstance(l, list):
    ret = [l]
  else:
    for item in l:
      ret.extend(_FlattenList(item))

  return ret