docs: def _parse_create_update(cls, args, action, api_version):
          """
          Parse command line arguments to determine cluster parameters that can
          be used to create or update a cluster.
  
          Args:
              `args`: sequence of arguments
  
              `action`: "create", "update" or "clone"
  
          Returns:
              Object that contains cluster parameters
          """
          argparser = ArgumentParser(prog="cluster %s" % action)
  
          create_required = False
          label_required = False
  
          if action == "create":
              create_required = True
          elif action == "update":
              argparser.add_argument("cluster_id_label",
                                     help="id/label of the cluster to update")
          elif action == "clone":
              argparser.add_argument("cluster_id_label",
                                     help="id/label of the cluster to update")
              label_required = True
  
          argparser.add_argument("--label", dest="label",
                                 nargs="+", required=(create_required or label_required),
                                 help="list of labels for the cluster" +
                                      " (atleast one label is required)")
  
          ec2_group = argparser.add_argument_group("ec2 settings")
          ec2_group.add_argument("--access-key-id",
                                 dest="aws_access_key_id",
                                 help="access key id for customer's aws" +
                                      " account. This is required while" +
                                      " creating the cluster",)
          ec2_group.add_argument("--secret-access-key",
                                 dest="aws_secret_access_key",
                                 help="secret access key for customer's aws" +
                                      " account. This is required while" +
                                      " creating the cluster",)
          ec2_group.add_argument("--aws-region",
                                 dest="aws_region",
                                 choices=["us-east-1", "us-west-2", "ap-northeast-1", "sa-east-1",
                                          "eu-west-1", "ap-southeast-1", "us-west-1"],
                                 help="aws region to create the cluster in",)
          ec2_group.add_argument("--aws-availability-zone",
                                 dest="aws_availability_zone",
                                 help="availability zone to" +
                                      " create the cluster in",)
          ec2_group.add_argument("--subnet-id",
                                 dest="subnet_id",
                                 help="subnet to create the cluster in",)
          ec2_group.add_argument("--vpc-id",
                                 dest="vpc_id",
                                 help="vpc to create the cluster in",)
          ec2_group.add_argument("--master-elastic-ip",
                                 dest="master_elastic_ip",
                                 help="elastic ip to attach to master",)
          ec2_group.add_argument("--bastion-node-public-dns",
                                 dest="bastion_node_public_dns",
                                 help="public dns name of the bastion node. Required only if cluster is in private subnet of a EC2-VPC",)
          ec2_group.add_argument("--role-instance-profile",
                                 dest="role_instance_profile",
                                 help="IAM Role instance profile to attach on cluster",)
  
          hadoop_group = argparser.add_argument_group("hadoop settings")
          node_config_group = argparser.add_argument_group("node configuration") if (api_version >= 1.3) else hadoop_group
  
          node_config_group.add_argument("--master-instance-type",
                                    dest="master_instance_type",
                                    help="instance type to use for the hadoop" +
                                         " master node",)
          node_config_group.add_argument("--slave-instance-type",
                                    dest="slave_instance_type",
                                    help="instance type to use for the hadoop" +
                                         " slave nodes",)
          node_config_group.add_argument("--initial-nodes",
                                    dest="initial_nodes",
                                    type=int,
                                    help="number of nodes to start the" +
                                         " cluster with",)
          node_config_group.add_argument("--max-nodes",
                                    dest="max_nodes",
                                    type=int,
                                    help="maximum number of nodes the cluster" +
                                         " may be auto-scaled up to")
          node_config_group.add_argument("--slave-request-type",
                                    dest="slave_request_type",
                                    choices=["ondemand", "spot", "hybrid", "spotblock"],
                                    help="purchasing option for slave instaces",)
          node_config_group.add_argument("--root-volume-size",
                                         dest="root_volume_size",
                                         type=int,
                                         help="size of root volume in GB")
          hadoop_group.add_argument("--custom-config",
                                    dest="custom_config_file",
                                    help="location of file containg custom" +
                                         " hadoop configuration overrides")
          hadoop_group.add_argument("--use-hbase", dest="use_hbase",
                                    action="store_true", default=None,
                                    help="Use hbase on this cluster",)
          hadoop_group.add_argument("--is-ha", dest="is_ha",
                                    action="store_true", default=None,
                                    help="Enable HA config for cluster")
          if api_version >= 1.3:
            qubole_placement_policy_group = hadoop_group.add_mutually_exclusive_group()
            qubole_placement_policy_group.add_argument("--use-qubole-placement-policy",
                                                dest="use_qubole_placement_policy",
                                                action="store_true",
                                                default=None,
                                                help="Use Qubole Block Placement policy" +
                                                     " for clusters with spot nodes",)
            qubole_placement_policy_group.add_argument("--no-use-qubole-placement-policy",
                                                dest="use_qubole_placement_policy",
                                                action="store_false",
                                                default=None,
                                                help="Do not use Qubole Block Placement policy" +
                                                     " for clusters with spot nodes",)
            fallback_to_ondemand_group = node_config_group.add_mutually_exclusive_group()
            fallback_to_ondemand_group.add_argument("--fallback-to-ondemand",
                                   dest="fallback_to_ondemand",
                                   action="store_true",
                                   default=None,
                                   help="Fallback to on-demand nodes if spot nodes" +
                                   " could not be obtained. Valid only if slave_request_type is spot",)
            fallback_to_ondemand_group.add_argument("--no-fallback-to-ondemand",
                                   dest="fallback_to_ondemand",
                                   action="store_false",
                                   default=None,
                                   help="Dont Fallback to on-demand nodes if spot nodes" +
                                   " could not be obtained. Valid only if slave_request_type is spot",)
            node_cooldown_period_group = argparser.add_argument_group("node cooldown period settings")
            node_cooldown_period_group.add_argument("--node-base-cooldown-period",
                                                    dest="node_base_cooldown_period",
                                                    type=int,
                                                    help="Cooldown period for on-demand nodes" +
                                                         " unit: minutes")
            node_cooldown_period_group.add_argument("--node-spot-cooldown-period",
                                                    dest="node_spot_cooldown_period",
                                                    type=int,
                                                    help="Cooldown period for spot nodes" +
                                                         " unit: minutes")
            ebs_volume_group = argparser.add_argument_group("ebs volume settings")
            ebs_volume_group.add_argument("--ebs-volume-count",
                                    dest="ebs_volume_count",
                                    type=int,
                                    help="Number of EBS volumes to attach to" +
                                         " each instance of the cluster",)
            ebs_volume_group.add_argument("--ebs-volume-type",
                                    dest="ebs_volume_type",
                                    choices=["standard", "gp2"],
                                    help=" of the EBS volume. Valid values are " +
                                         "'standard' (magnetic) and 'gp2' (ssd).",)
            ebs_volume_group.add_argument("--ebs-volume-size",
                                    dest="ebs_volume_size",
                                    type=int,
                                    help="Size of each EBS volume, in GB",)
            enable_rubix_group = hadoop_group.add_mutually_exclusive_group()
            enable_rubix_group.add_argument("--enable-rubix",
                                                dest="enable_rubix",
                                                action="store_true",
                                                default=None,
                                                help="Enable rubix for cluster", )
            enable_rubix_group.add_argument("--no-enable-rubix",
                                                dest="enable_rubix",
                                                action="store_false",
                                                default=None,
                                                help="Do not enable rubix for cluster", )
  
          hadoop2 = hadoop_group.add_mutually_exclusive_group()
          hadoop2.add_argument("--use-hadoop2",
                               dest="use_hadoop2",
                               action="store_true",
                               default=None,
                               help="Use hadoop2 instead of hadoop1")
          hadoop2.add_argument("--use-hadoop1",
                               dest="use_hadoop2",
                               action="store_false",
                               default=None,
                               help="Use hadoop1 instead of hadoop2. This is the default.")
          hadoop2.add_argument("--use-spark",
                             dest="use_spark",
                             action="store_true",
                             default=None,
                             help="Turn on spark for this cluster")
  
          spot_group = argparser.add_argument_group("spot instance settings" +
                      " (valid only when slave-request-type is hybrid or spot)")
          spot_group.add_argument("--maximum-bid-price-percentage",
                                  dest="maximum_bid_price_percentage",
                                  type=float,
                                  help="maximum value to bid for spot instances" +
                                       " expressed as a percentage of the base" +
                                       " price for the slave node instance type",)
          spot_group.add_argument("--timeout-for-spot-request",
                                  dest="timeout_for_request",
                                  type=int,
                                  help="timeout for a spot instance request" +
                                       " unit: minutes")
          spot_group.add_argument("--maximum-spot-instance-percentage",
                                  dest="maximum_spot_instance_percentage",
                                  type=int,
                                  help="maximum percentage of instances that may" +
                                       " be purchased from the aws spot market," +
                                       " valid only when slave-request-type" +
                                       " is 'hybrid'",)
  
          stable_spot_group = argparser.add_argument_group("stable spot instance settings")
          stable_spot_group.add_argument("--stable-maximum-bid-price-percentage",
                                         dest="stable_maximum_bid_price_percentage",
                                         type=float,
                                         help="maximum value to bid for stable node spot instances" +
                                         " expressed as a percentage of the base" +
                                         " price for the master and slave node instance types",)
          stable_spot_group.add_argument("--stable-timeout-for-spot-request",
                                         dest="stable_timeout_for_request",
                                         type=int,
                                         help="timeout for a stable node spot instance request" +
                                         " unit: minutes")
          stable_spot_group.add_argument("--stable-allow-fallback",
                                         dest="stable_allow_fallback", default=None,
                                         type=str2bool,
                                         help="whether to fallback to on-demand instances for stable nodes" +
                                         " if spot instances aren't available")
  
          spot_block_group = argparser.add_argument_group("spot block settings")
          spot_block_group.add_argument("--spot-block-duration",
                                        dest="spot_block_duration",
                                        type=int,
                                        help="spot block duration" +
                                             " unit: minutes")
  
          fairscheduler_group = argparser.add_argument_group(
                                "fairscheduler configuration options")
          fairscheduler_group.add_argument("--fairscheduler-config-xml",
                                           dest="fairscheduler_config_xml_file",
                                           help="location for file containing" +
                                                " xml with custom configuration" +
                                                " for the fairscheduler",)
          fairscheduler_group.add_argument("--fairscheduler-default-pool",
                                           dest="default_pool",
                                           help="default pool for the" +
                                                " fairscheduler",)
  
          security_group = argparser.add_argument_group("security setttings")
          ephemerals = security_group.add_mutually_exclusive_group()
          ephemerals.add_argument("--encrypted-ephemerals",
                                   dest="encrypted_ephemerals",
                                   action="store_true",
                                   default=None,
                                   help="encrypt the ephemeral drives on" +
                                        " the instance",)
          ephemerals.add_argument("--no-encrypted-ephemerals",
                                   dest="encrypted_ephemerals",
                                   action="store_false",
                                   default=None,
                                   help="don't encrypt the ephemeral drives on" +
                                        " the instance",)
  
          security_group.add_argument("--customer-ssh-key",
                                      dest="customer_ssh_key_file",
                                      help="location for ssh key to use to" +
                                           " login to the instance")
  
          security_group.add_argument("--persistent-security-group",
                                      dest="persistent_security_group",
                                      help="a security group to associate with each" +
                                           " node of the cluster. Typically used" +
                                           " to provide access to external hosts")
  
          presto_group = argparser.add_argument_group("presto settings")
          enabling_presto = presto_group.add_mutually_exclusive_group()
          enabling_presto.add_argument("--enable-presto",
                                    dest="enable_presto",
                                    action="store_true",
                                    default=None,
                                    help="Enable presto for this cluster",)
          enabling_presto.add_argument("--disable-presto",
                                    dest="enable_presto",
                                    action="store_false",
                                    default=None,
                                    help="Disable presto for this cluster",)
          presto_group.add_argument("--presto-custom-config",
                                    dest="presto_custom_config_file",
                                    help="location of file containg custom" +
                                         " presto configuration overrides")
  
          termination = argparser.add_mutually_exclusive_group()
          termination.add_argument("--disallow-cluster-termination",
                                   dest="disallow_cluster_termination",
                                   action="store_true",
                                   default=None,
                                   help="don't auto-terminate idle clusters," +
                                        " use this with extreme caution",)
          termination.add_argument("--allow-cluster-termination",
                                   dest="disallow_cluster_termination",
                                   action="store_false",
                                   default=None,
                                   help="auto-terminate idle clusters,")
  
          ganglia = argparser.add_mutually_exclusive_group()
          ganglia.add_argument("--enable-ganglia-monitoring",
                               dest="enable_ganglia_monitoring",
                               action="store_true",
                               default=None,
                               help="enable ganglia monitoring for the" +
                                    " cluster",)
          ganglia.add_argument("--disable-ganglia-monitoring",
                               dest="enable_ganglia_monitoring",
                               action="store_false",
                               default=None,
                               help="disable ganglia monitoring for the" +
                                    " cluster",)
  
          argparser.add_argument("--node-bootstrap-file",
                  dest="node_bootstrap_file",
                  help="""name of the node bootstrap file for this cluster. It
                  should be in stored in S3 at
                  <account-default-location>/scripts/hadoop/NODE_BOOTSTRAP_FILE
                  """,)
  
          argparser.add_argument("--custom-ec2-tags",
                                 dest="custom_ec2_tags",
                                 help="""Custom ec2 tags to be set on all instances
                                 of the cluster. Specified as JSON object (key-value pairs)
                                 e.g. --custom-ec2-tags '{"key1":"value1", "key2":"value2"}'
                                 """,)
          env_group = argparser.add_argument_group("environment settings")
          env_group.add_argument("--env-name",
                                 dest="env_name",
                                 default=None,
                                 help="name of Python and R environment")
          env_group.add_argument("--python-version",
                                 dest="python_version",
                                 default=None,
                                 help="version of Python in environment")
          env_group.add_argument("--r-version",
                                 dest="r_version",
                                 default=None,
                                 help="version of R in environment")
  
          arguments = argparser.parse_args(args)
          return arguments