code: def reverse_deployments(deployments=None):
          
          if deployments is None:
              deployments = []
  
          reversed_deployments = []
          for i in deployments[::-1]:
              deployment = copy.deepcopy(i)
              for config in ['modules', 'regions']:
                  if deployment.get(config):
                      deployment[config] = deployment[config][::-1]
              reversed_deployments.append(deployment)
          return reversed_deployments
docs: Reverse deployments and the modules/regions in them.