def _prepare_ticket_fields(operation, fields):
    """
    Makes sure each key value pair in the fields dictionary is in the correct form.
    :param operation: Key for identification of operation type.
    :param fields: Ticket fields.
    :return: fields: Ticket fields in the correct form for the ticketing tool.
    """
    if 'edit' in operation:
        if 'groups' in fields:
            if not isinstance(fields['groups'], list):
                fields['groups'] = [fields['groups']]
            fields['groups'] = {'add': fields['groups']}
    for key, value in fields.items():
        if key == 'assignee':
            fields['assigned_to'] = value
            fields.pop('assignee')
    return fields
