code: def apply_args(
      profile: Profile, args: List[str]
  ) -> Tuple[Profile, argparse.Namespace]:
      parser = argparse.ArgumentParser()
      register_profile_args(parser)
      profile = profile.copy(
          deep=True
      )  # to avoid modifying the original profile
      args = parser.parse_args(args)
      apply_profile_args(args, profile)
      return profile, args
  
imports: import argparse
  from typing import List, Tuple
  import pytest
  from dstack._internal.cli.services.configurators.profile import apply_profile_args, gpu_spec, register_profile_args
  from dstack._internal.core.models.profiles import Profile, ProfileGPU, ProfileResources, ProfileRetryPolicy, SpotPolicy
label_desc: Use image node_id 1 for calling a global function with example usage: apply_args(profile, args) and returns: profile,  args