code: def generate_cloudformation_args(stack_name, parameters, tags, template,
                                   capabilities=DEFAULT_CAPABILITIES,
                                   change_set_type=None,
                                   service_role=None,
                                   stack_policy=None,
                                   change_set_name=None):
      
      args = {
          "StackName": stack_name,
          "Parameters": parameters,
          "Tags": tags,
          "Capabilities": capabilities,
      }
  
      if service_role:
          args["RoleARN"] = service_role
  
      if change_set_name:
          args["ChangeSetName"] = change_set_name
  
      if change_set_type:
          args["ChangeSetType"] = change_set_type
  
      if template.url:
          args["TemplateURL"] = template.url
      else:
          args["TemplateBody"] = template.body
  
      # When creating args for CreateChangeSet, don't include the stack policy,
      # since ChangeSets don't support it.
      if not change_set_name:
          args.update(generate_stack_policy_args(stack_policy))
  
      return args
docs: Used to generate the args for common cloudformation API interactions.
  
      This is used for create_stack/update_stack/create_change_set calls in
      cloudformation.
  
      Args:
          stack_name (str): The fully qualified stack name in Cloudformation.
          parameters (list): A list of dictionaries that defines the
              parameter list to be applied to the Cloudformation stack.
          tags (list): A list of dictionaries that defines the tags
              that should be applied to the Cloudformation stack.
          template (:class:`stacker.provider.base.Template`): The template
              object.
          capabilities (list, optional): A list of capabilities to use when
              updating Cloudformation.
          change_set_type (str, optional): An optional change set type to use
              with create_change_set.
          service_role (str, optional): An optional service role to use when
              interacting with Cloudformation.
          stack_policy (:class:`stacker.providers.base.Template`): A template
              object representing a stack policy.
          change_set_name (str, optional): An optional change set name to use
              with create_change_set.
  
      Returns:
          dict: A dictionary of arguments to be used in the Cloudformation API
              call.