code: def get_pending_migrations(path, databases=None, stop_at=None):
      
      if stop_at is None:
          stop_at = float("inf")
      
      # database: [(number, full_path)]
      possible_migrations = get_all_migrations(path, databases)
      # database: [full_path]
      applied_migrations = get_applied_migrations(databases)
      # database: [full_path]
      to_execute = defaultdict(list)
      
      for database, scripts in possible_migrations.iteritems():
          applied = applied_migrations[database]
          pending = to_execute[database]
          for number, migration in scripts:
              path, script = os.path.split(migration)
              if script not in applied and number <= stop_at:
                  pending.append(script)
      
      return dict((k, v) for k, v in to_execute.iteritems() if v)
docs: Returns a dictionary of database => [migrations] representing all pending
      migrations.