def split_tuple(s):
  """Split a string of comma-separated expressions at the top level, 
  respecting parentheses and brackets:
  e.g. 'a, b, c(d, e), f' -> ['a', 'b', 'c(d, e)', 'f']

  Args:
      s (string): a string of comma-separated expressions which may themselves contain commas

  Returns:
      list(str): a list of top-level expressions
  """
  bl = 0  # Bracketing level
  ls = []
  w = ""
  for i, c in enumerate(s):

      if c in "[(":
          bl += 1
      elif c in ")]":
          bl -= 1
      if c == "," and not bl: # Add running word to the list as long as we're outside of brackets
          ls.append(w.strip())
          w = ""
      else:
          w += c # Add character to running string
  ls.append(w.strip())
  return ls