Compile tops

def top(**kwargs):
    '''
    Compile tops
    '''
    # Node definitions path will be retrieved from args (or set to default),
    # then added to 'salt_data' dict that is passed to the 'get_pillars'
    # function. The dictionary contains:
    #     - __opts__
    #     - __salt__
    #     - __grains__
    #     - __pillar__
    #     - minion_id
    #     - path
    #
    # If successful, the function will return a pillar dict for minion_id.

    # If path has not been set, make a default
    _opts = __opts__['master_tops']['saltclass']
    if 'path' not in _opts:
        path = '/srv/saltclass'
        log.warning('path variable unset, using default: %s', path)
    else:
        path = _opts['path']

    # Create a dict that will contain our salt objects
    # to send to get_tops function
    if 'id' not in kwargs['opts']:
        log.warning('Minion id not found - Returning empty dict')
        return {}
    else:
        minion_id = kwargs['opts']['id']

    salt_data = {
        '__opts__': kwargs['opts'],
        '__salt__': {},
        '__grains__': kwargs['grains'],
        '__pillar__': {},
        'minion_id': minion_id,
        'path': path
    }

    return sc.get_tops(minion_id, salt_data)