def choices(x):
  """
  Takes a list of lists x and returns all possible choices of one element from each sublist.
  
  >>> choices([range(2), range(3), ["foo"]])
  [ [0, 0, "foo"], [0, 1, "foo"], [0, 2, "foo"], [1, 0, "foo"], [1, 1, "foo"], [1, 2, "foo"] ]
  """
  if len(x) == 0:
    return [[]]
  
  else:
    res = []
    for item in x[0]:
      res += [ [item] + sub for sub in choices(x[1:]) ]
    return res