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

def service_highstate(requires=True):
    '''
    Return running and enabled services in a highstate structure. By default
    also returns package dependencies for those services, which means that
    package definitions must be created outside this function. To drop the
    package dependencies, set ``requires`` to False.

    CLI Example:

        salt myminion introspect.service_highstate
        salt myminion introspect.service_highstate requires=False
    '''
    ret = {}
    running = running_service_owners()
    for service in running:
        ret[service] = {'service': ['running']}

        if requires:
            ret[service]['service'].append(
                {'require': {'pkg': running[service]}}
            )

    enabled = enabled_service_owners()
    for service in enabled:
        if service in ret:
            ret[service]['service'].append({'enabled': True})
        else:
            ret[service] = {'service': [{'enabled': True}]}

        if requires:
            exists = False
            for item in ret[service]['service']:
                if isinstance(item, dict) and next(six.iterkeys(item)) == 'require':
                    exists = True
            if not exists:
                ret[service]['service'].append(
                    {'require': {'pkg': enabled[service]}}
                )

    return ret