@resources.command<EOL><INDENT>@click.option('<STR_LIT>', type=types.Related('<STR_LIT>'),<EOL>required=False, help='<STR_LIT>')<EOL>def create(self, fail_on_found=False, force_on_exists=False, **kwargs):<DEDENT>
jt_id = kwargs.pop('<STR_LIT>', None)<EOL>old_endpoint = self.endpoint<EOL>if jt_id is not None:<EOL><INDENT>jt = get_resource('<STR_LIT>')<EOL>jt.get(pk=jt_id)<EOL>try:<EOL><INDENT>label_id = self.get(name=kwargs.get('<STR_LIT:name>', None), organization=kwargs.get('<STR_LIT>', None))['<STR_LIT:id>']<EOL><DEDENT>except exc.NotFound:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if fail_on_found:<EOL><INDENT>raise exc.TowerCLIError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>debug.log('<STR_LIT>', header='<STR_LIT>')<EOL>return jt.associate_label(job_template=jt_id, label=label_id)<EOL><DEDENT><DEDENT>self.endpoint = '<STR_LIT>' % jt_id<EOL><DEDENT>result = super(Resource, self).create(fail_on_found=fail_on_found, force_on_exists=force_on_exists, **kwargs)<EOL>self.endpoint = old_endpoint<EOL>return result<EOL>
Create a new label.

        There are two types of label creation: isolatedly creating a new label and creating a new label under
        a job template. Here the two types are discriminated by whether to provide --job-template option.

        Fields in the resource's `identity` tuple are used for a lookup; if a match is found, then no-op (unless
        `force_on_exists` is set) but do not fail (unless `fail_on_found` is set).

        =====API DOCS=====
        Create a label.

        :param job_template: Primary key or name of the job template for the created label to associate to.
        :type job_template: str
        :param fail_on_found: Flag that if set, the operation fails if an object matching the unique criteria
                              already exists.
        :type fail_on_found: bool
        :param force_on_exists: Flag that if set, then if a match is found on unique fields, other fields will
                                be updated to the provided values.; If unset, a match causes the request to be
                                a no-op.
        :type force_on_exists: bool
        :param `**kwargs`: Keyword arguments which, all together, will be used as POST body to create the
                           resource object.
        :returns: A dictionary combining the JSON output of the created resource, as well as two extra fields:
                  "changed", a flag indicating if the resource is created successfully; "id", an integer which
                  is the primary key of the created object.
        :rtype: dict
        :raises tower_cli.exceptions.TowerCLIError: When the label already exists and ``fail_on_found`` flag is on.

        =====API DOCS=====