code: def get_migrations(path):
      '''
      In the specified directory, get all the files which match the pattern
      0001_migration.py
      '''
      pattern = re.compile(r"\d+_[\w\d]+")
      modules = [name for _, name, _ in pkgutil.iter_modules([path])
                  if pattern.match(name)
              ]
  
      return sorted(modules, key=lambda name: int(name.split("_")[0])f get_migrations(path):
      '''
      In the specified directory, get all the files which match the pattern
      0001_migration.py
      '''
      pattern = re.compile(r"\d+_[\w\d]+")
      modules = [name for _, name, _ in pkgutil.iter_modules([path])
                  if pattern.match(name)
              ]
  
      return sorted(modules, key=lambda name: int(name.split("_")[0]))
docs: In the specified directory, get all the files which match the pattern
      0001_migration.py