<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_ticket(self, Queue=None, files=[], **kwargs):
 """ Create new ticket and set given parameters. Example of message sended to ``http://tracker.example.com/REST/1.0/ticket/new``:: content=id: ticket/new Queue: General Owner: Nobody Requestors: somebody@example.com Subject: Ticket created through REST API Text: Lorem Ipsum In case of success returned message has this form:: RT/3.8.7 200 Ok # Ticket 123456 created. # Ticket 123456 updated. Otherwise:: RT/3.8.7 200 Ok # Required: id, Queue + list of some key, value pairs, probably default values. :keyword Queue: Queue where to create ticket :keyword files: Files to attach as multipart/form-data List of 2/3 tuples: (filename, file-like object, [content type]) :keyword kwargs: Other arguments possible to set: Requestors, Subject, Cc, AdminCc, Owner, Status, Priority, InitialPriority, FinalPriority, fields) Custom fields CF.{<CustomFieldName>} could be set with keywords CF_CustomFieldName. :returns: ID of new ticket or ``-1``, if creating failed """


        post_data = 'id: ticket/new\nQueue: {}\n'.format(Queue or self.default_queue, )
        for key in kwargs:
            if key[:4] == 'Text':
                post_data += "{}: {}\n".format(key, re.sub(r'\n', r'\n      ', kwargs[key]))
            elif key[:3] == 'CF_':
                post_data += "CF.{{{}}}: {}\n".format(key[3:], kwargs[key])
            else:
                post_data += "{}: {}\n".format(key, kwargs[key])
        for file_info in files:
            post_data += "\nAttachment: {}".format(file_info[0], )
        msg = self.__request('ticket/new', post_data={'content': post_data}, files=files)
        for line in msg.split('\n')[2:-1]:
            res = self.RE_PATTERNS['ticket_created_pattern'].match(line)
            if res is not None:
                return int(res.group(1))
            warnings.warn(line[2:])
        return -1