title: python apply a function after checking if variable is single list or list of lists
body: <p>I intend to apply a function to a variable. I do not know beforehand if the incoming variable will be a list of list or a single list. e.g</p>
  
  <pre><code>var_name = [a, b, c]
  or
  var_name = [[a,b,c], [d,e,f], [h,i,j]]
  </code></pre>
  
  <p>The list of list could contain as many lists as possible. How do I go about verifying if the variable is a list or list of lists. I intend to apply a function depending on the type. I tried to use len(var_name) but the length for list will be the number of items in single list while for list of lists, it is the number of lists in the list of lists.</p>
  
  <p>what I am trying to achieve is this:</p>
  
  <pre><code>#function for list
  def apply_val(lst):
      do something with single list
  #function for list of list
  def apply_val2(lst):
      do something with list of lists
  
  var_name = single_list or list_of_lists
  if var_name == single list
      apply_val(single_list)
  else:
      apply_val(list_of_lists)
  </code></pre>
  
  <p>How do I check if the var_name is a list or list of lists?</p>