code: def profile_args(_args):
          
          # TODO: clean this up in a way that works for both py2/3
          if (
              _args.get('app', {}).get('optional') is not None
              or _args.get('app', {}).get('required') is not None
          ):
              # detect v3 schema
              app_args_optional = _args.get('app', {}).get('optional', {})
              app_args_required = _args.get('app', {}).get('required', {})
              default_args = _args.get('default', {})
              _args = {}
              _args.update(app_args_optional)
              _args.update(app_args_required)
              _args.update(default_args)
          elif _args.get('app') is not None and _args.get('default') is not None:
              # detect v2 schema
              app_args = _args.get('app', {})
              default_args = _args.get('default', {})
              _args = {}
              _args.update(app_args)
              _args.update(default_args)
  
          return _args
docs: Return args for v1, v2, or v3 structure.
  
          Args:
              _args (dict): The args section from the profile.
  
          Returns:
              dict: A collapsed version of the args dict.