code: def get_paths(patterns, start_dirs=None, max_depth=1):
      if len(patterns) == 1 and not start_dirs:
          pattern = patterns[0]
          directory = os.path.dirname(pattern)
          if directory:
              patterns = [os.path.basename(pattern)]
              start_dirs = directory
              max_depth = 1
      if not start_dirs or start_dirs == '.':
          start_dirs = os.getcwd()
      for start_dir in start_dirs.split(','):
          for root, dirs, files in os.walk(start_dir):
              if max_depth is not None:
                  relpath = os.path.relpath(root, start=start_dir)
                  depth = len(relpath.split(os.sep))
                  if depth > max_depth:
                      continue
              names = []
              for pattern in patterns:
                  names += fnmatch.filter(files, pattern)
              for name in names:
                  path = os.path.join(root, name)
                  yield path