code: def sort_loading_order(step_files):
      
      tools = []
      workflows = []
      workflows_with_subworkflows = []
  
      for f in step_files:
          # assume that urls are tools
          if f.startswith('http://') or f.startswith('https://'):
              tools.append(f)
          else:
              obj = load_yaml(f)
              if obj.get('class', '') == 'Workflow':
                  if 'requirements' in obj.keys():
                      subw = {'class': 'SubworkflowFeatureRequirement'}
                      if subw in obj['requirements']:
                          workflows_with_subworkflows.append(f)
                      else:
                          workflows.append(f)
                  else:
                      workflows.append(f)
              else:
                  tools.append(f)
      return tools + workflows + workflows_with_subworkflows
docs: Sort step files into correct loading order.
  
      The correct loading order is first tools, then workflows without
      subworkflows, and then workflows with subworkflows. This order is
      required to avoid error messages when a working directory is used.