def METHOD_NAME(method):
    direct_method = CloudToDeviceMethod(method_name=method.method_name, payload=method.serialize())
    registry_manager = IoTHubRegistryManager(connection_string=connection_string)
    payload = registry_manager.invoke_device_module_method(device_id=device_id, module_id=module_d, direct_method_request=direct_method).payload
    if payload is not None and 'error' in payload:
        print(payload['error'])
        return None
    return payload