def running(name,
            restart=False,
            remote_addr=None,
            cert=None,
            key=None,
            verify_cert=True):
    '''
    Ensure a LXD container is running and restart it if restart is True

    name :
        The name of the container to start/restart.

    restart :
        restart the container if it is already started.

    remote_addr :
        An URL to a remote Server, you also have to give cert and key if you
        provide remote_addr!

        Examples:
            https://myserver.lan:8443
            /var/lib/mysocket.sock

    cert :
        PEM Formatted SSL Zertifikate.

        Examples:
            ~/.config/lxc/client.crt

    key :
        PEM Formatted SSL Key.

        Examples:
            ~/.config/lxc/client.key

    verify_cert : True
        Wherever to verify the cert, this is by default True
        but in the most cases you want to set it off as LXD
        normaly uses self-signed certificates.
    '''
    ret = {
        'name': name,
        'restart': restart,

        'remote_addr': remote_addr,
        'cert': cert,
        'key': key,
        'verify_cert': verify_cert,

        'changes': {}
    }

    try:
        container = __salt__['lxd.container_get'](
            name, remote_addr, cert, key, verify_cert, _raw=True
        )
    except CommandExecutionError as e:
        return _error(ret, six.text_type(e))
    except SaltInvocationError as e:
        # Container not found
        return _error(ret, 'Container "{0}" not found'.format(name))

    is_running = container.status_code == CONTAINER_STATUS_RUNNING

    if is_running:
        if not restart:
            return _success(
                ret,
                'The container "{0}" is already running'.format(name)
            )
        else:
            if __opts__['test']:
                ret['changes']['restarted'] = (
                    'Would restart the container "{0}"'.format(name)
                )
                return _unchanged(ret, ret['changes']['restarted'])
            else:
                container.restart(wait=True)
                ret['changes']['restarted'] = (
                    'Restarted the container "{0}"'.format(name)
                )
                return _success(ret, ret['changes']['restarted'])

    if __opts__['test']:
        ret['changes']['started'] = (
            'Would start the container "{0}"'.format(name)
        )
        return _unchanged(ret, ret['changes']['started'])

    container.start(wait=True)
    ret['changes']['started'] = (
        'Started the container "{0}"'.format(name)
    )
    return _success(ret, ret['changes']['started'])
Ensure a LXD container is running and restart it if restart is True

    name :
        The name of the container to start/restart.

    restart :
        restart the container if it is already started.

    remote_addr :
        An URL to a remote Server, you also have to give cert and key if you
        provide remote_addr!

        Examples:
            https://myserver.lan:8443
            /var/lib/mysocket.sock

    cert :
        PEM Formatted SSL Zertifikate.

        Examples:
            ~/.config/lxc/client.crt

    key :
        PEM Formatted SSL Key.

        Examples:
            ~/.config/lxc/client.key

    verify_cert : True
        Wherever to verify the cert, this is by default True
        but in the most cases you want to set it off as LXD
        normaly uses self-signed certificates.