import glob


def deglob(files):
  """
  Given a list of files and globs, returns all the files and any files in the globs.
  """
  new_files = []
  for fn_or_glob in files:
    found = False
    for fn in glob.glob(fn_or_glob):
      new_files.append(fn)
      found = True
    if not found:
      raise Exception('Pattern {} did not match any files.'.format(fn_or_glob))
  return new_files