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

def _parse_profile(profile):
    '''
    From a pillar key, or a dictionary, return index and host keys.
    '''
    if isinstance(profile, string_types):
        _profile = __salt__['config.option'](profile)
        if not _profile:
            msg = 'Pillar key for profile {0} not found.'.format(profile)
            raise SaltInvocationError(msg)
    else:
        _profile = profile
    hosts = _profile.get('hosts')
    index = _profile.get('index')
    return (hosts, index)