Execute hiera and return the data

def ext_pillar(minion_id,  # pylint: disable=W0613
               pillar,  # pylint: disable=W0613
               conf):
    '''
    Execute hiera and return the data
    '''
    cmd = 'hiera -c {0}'.format(conf)
    for key, val in six.iteritems(__grains__):
        if isinstance(val, six.string_types):
            cmd += ' {0}=\'{1}\''.format(key, val)
    try:
        data = salt.utils.yaml.safe_load(__salt__['cmd.run'](cmd))
    except Exception:
        log.critical('Hiera YAML data failed to parse from conf %s', conf)
        return {}
    return data