<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def template_clone(call=None, kwargs=None):
    '''
    Clones an existing virtual machine template.

    .. versionadded:: 2016.3.0

    name
        The name of the new template.

    template_id
        The ID of the template to be cloned. Can be used instead of ``template_name``.

    template_name
        The name of the template to be cloned. Can be used instead of ``template_id``.

    clone_images
        Optional, defaults to False. Indicates if the images attached to the template should be cloned as well.

    CLI Example:

    .. code-block:: bash

        salt-cloud -f template_clone opennebula name=my-new-template template_id=0
        salt-cloud -f template_clone opennebula name=my-new-template template_name=my-template
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The template_clone function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    name = kwargs.get('name', None)
    template_id = kwargs.get('template_id', None)
    template_name = kwargs.get('template_name', None)
    clone_images = kwargs.get('clone_images', False)

    if name is None:
        raise SaltCloudSystemExit(
            'The template_clone function requires a name to be provided.'
        )

    if template_id:
        if template_name:
            log.warning(
                'Both the \'template_id\' and \'template_name\' arguments were provided. '
                '\'template_id\' will take precedence.'
            )
    elif template_name:
        template_id = get_template_id(kwargs={'name': template_name})
    else:
        raise SaltCloudSystemExit(
            'The template_clone function requires either a \'template_id\' '
            'or a \'template_name\' to be provided.'
        )

    server, user, password = _get_xml_rpc()
    auth = ':'.join([user, password])

    response = server.one.template.clone(auth, int(template_id), name, clone_images)

    data = {
        'action': 'template.clone',
        'cloned': response[0],
        'cloned_template_id': response[1],
        'cloned_template_name': name,
        'error_code': response[2],
    }

    return data