<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def active_services(doc):
 """View for getting active services"""

    if doc.get('state') != 'deactivated':
        for service_id, service in doc.get('services', {}).items():
            if service.get('state') != 'deactivated':
                service_type = service.get('service_type')
                org = doc['_id']
                service['id'] = service_id
                service['organisation_id'] = org

                yield service_id, service
                yield [service_type, org], service
                yield [service_type, None], service
                yield [None, org], service
                yield [None, None], service