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

def cloud(tgt, provider=None):
    '''
    Return cloud cache data for target.

    .. note:: Only works with glob matching

    tgt
      Glob Target to match minion ids

    provider
      Cloud Provider

    CLI Example:

    .. code-block:: bash

        salt-run cache.cloud 'salt*'
        salt-run cache.cloud glance.example.org provider=openstack
    '''
    if not isinstance(tgt, six.string_types):
        return {}

    opts = salt.config.cloud_config(
        os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud')
    )
    if not opts.get('update_cachedir'):
        return {}

    cloud_cache = __utils__['cloud.list_cache_nodes_full'](opts=opts, provider=provider)
    if cloud_cache is None:
        return {}

    ret = {}
    for driver, providers in six.iteritems(cloud_cache):
        for provider, servers in six.iteritems(providers):
            for name, data in six.iteritems(servers):
                if fnmatch.fnmatch(name, tgt):
                    ret[name] = data
                    ret[name]['provider'] = provider
    return ret