def get_provider_manager(osid, runtime=None, proxy=None, local=False):
if runtime is not None:<EOL><INDENT>if local:<EOL><INDENT>parameter_id = Id('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>parameter_id = Id('<STR_LIT>' + osid.lower() + '<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>config = runtime.get_configuration()<EOL>impl_name = config.get_value_by_parameter(parameter_id).get_string_value()<EOL>if proxy is None:<EOL><INDENT>return runtime.get_manager(osid, impl_name)<EOL><DEDENT>else:<EOL><INDENT>return runtime.get_proxy_manager(osid, impl_name)<EOL><DEDENT><DEDENT>except (AttributeError, KeyError, NotFound):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>try:<EOL><INDENT>if proxy is None:<EOL><INDENT>mgr_str = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>mgr_str = '<STR_LIT>'<EOL><DEDENT>module = import_module(<EOL>'<STR_LIT>' + fix_reserved_word(osid.lower(), is_module=True) + '<STR_LIT>')<EOL>manager_name = '<STR_LIT>'.join((osid.title()).split('<STR_LIT:_>')) + mgr_str<EOL>manager = getattr(module, manager_name)()<EOL><DEDENT>except (ImportError, AttributeError):<EOL><INDENT>raise OperationFailed()<EOL><DEDENT>if runtime is not None:<EOL><INDENT>manager.initialize(runtime)<EOL><DEDENT>return manager<EOL>
Gets the most appropriate provider manager depending on config.

If local is True, then don't bother with the runtime/config and
try to get the requested service manager directly from the local
service implementations known to this mongodb implementation.