def extract_capabilities(out_iter, kwargs, final, value):
    _log.debug("shadow_match:extract_capabilities BEGIN")
    shadow_params = kwargs.get('shadow_params', [])
    if not final[0] and value != dynops.FailedElement:
        _log.debug("shadow_match:extract_capabilities VALUE %s" % value)
        mandatory = value['args']['mandatory']
        optional = value['args']['optional'].keys()
        # To be valid actor type all mandatory params need to be supplied and only valid params
        if all([p in shadow_params for p in mandatory]) and all([p in (mandatory + optional) for p in shadow_params]):
            _log.debug("shadow_match:extract_capabilities ACT")
            kwargs['descriptions'].append(value)
            reqs = value['requires']
            new = set(reqs) - kwargs['capabilities']
            kwargs['capabilities'].update(new)
            out_iter.extend(new)
    if final[0]:
        _log.debug("shadow_match:extract_capabilities FINAL")
        out_iter.final()
    _log.debug("shadow_match:extract_capabilities END")
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/plugins/requirements/shadow_actor_reqs_match.py/extract_capabilities/original