def _instantiate_session(self, method_name, proxy=None, manager=None, *args, **kwargs):
if manager is None:<EOL><INDENT>manager = self._provider_manager<EOL><DEDENT>session_class = getattr(manager, method_name)<EOL>if proxy is None:<EOL><INDENT>try:<EOL><INDENT>return session_class(bank_id=self._catalog_id, *args, **kwargs)<EOL><DEDENT>except AttributeError:<EOL><INDENT>return session_class(*args, **kwargs)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>return session_class(bank_id=self._catalog_id, proxy=proxy, *args, **kwargs)<EOL><DEDENT>except AttributeError:<EOL><INDENT>return session_class(proxy=proxy, *args, **kwargs)<EOL><DEDENT><DEDENT>
Instantiates a provider session