def add_provider(self, share, provider, readonly=False):
<EOL>share = "<STR_LIT:/>" + share.strip("<STR_LIT:/>")<EOL>assert share not in self.provider_map<EOL>if compat.is_basestring(provider):<EOL><INDENT>provider = FilesystemProvider(provider, readonly)<EOL><DEDENT>elif type(provider) in (dict,):<EOL><INDENT>if "<STR_LIT>" in provider:<EOL><INDENT>prov_class = dynamic_import_class(provider["<STR_LIT>"])<EOL>provider = prov_class(<EOL>*provider.get("<STR_LIT:args>", []), **provider.get("<STR_LIT>", {})<EOL>)<EOL><DEDENT>else:<EOL><INDENT>provider = FilesystemProvider(<EOL>provider["<STR_LIT:root>"], bool(provider.get("<STR_LIT>", False))<EOL>)<EOL><DEDENT><DEDENT>elif type(provider) in (list, tuple):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(provider)<EOL>)<EOL><DEDENT>if not isinstance(provider, DAVProvider):<EOL><INDENT>raise ValueError("<STR_LIT>".format(provider))<EOL><DEDENT>provider.set_share_path(share)<EOL>if self.mount_path:<EOL><INDENT>provider.set_mount_path(self.mount_path)<EOL><DEDENT>provider.set_lock_manager(self.lock_manager)<EOL>provider.set_prop_manager(self.prop_manager)<EOL>self.provider_map[share] = provider<EOL>self.sorted_share_list = [s.lower() for s in self.provider_map.keys()]<EOL>self.sorted_share_list = sorted(self.sorted_share_list, key=len, reverse=True)<EOL>return provider<EOL>
Add a provider to the provider_map routing table.