def _CreateAptSettings(args, messages):
  """Creates an AptSettings message from input arguments."""
  if not any([args.apt_dist, args.apt_excludes, args.apt_exclusive_packages]):
    return None

  return messages.AptSettings(
      type=messages.AptSettings.TypeValueValuesEnum.DIST if args.apt_dist else
      messages.AptSettings.TypeValueValuesEnum.TYPE_UNSPECIFIED,
      excludes=args.apt_excludes if args.apt_excludes else [],
      exclusivePackages=args.apt_exclusive_packages
      if args.apt_exclusive_packages else [])