def WebCoverageService(url, version=None, xml=None, cookies=None, timeout=<NUM_LIT:30>):
if version is None:<EOL><INDENT>if xml is None:<EOL><INDENT>reader = wcsBase.WCSCapabilitiesReader()<EOL>request = reader.capabilities_url(url)<EOL>xml = openURL(request, cookies=cookies, timeout=timeout).read()<EOL><DEDENT>capabilities = etree.etree.fromstring(xml)<EOL>version = capabilities.get('<STR_LIT:version>')<EOL>del capabilities<EOL><DEDENT>clean_url = clean_ows_url(url)<EOL>if version == '<STR_LIT>':<EOL><INDENT>return wcs100.WebCoverageService_1_0_0.__new__(wcs100.WebCoverageService_1_0_0, clean_url, xml, cookies)<EOL><DEDENT>elif version == '<STR_LIT>':<EOL><INDENT>return wcs110.WebCoverageService_1_1_0.__new__(wcs110.WebCoverageService_1_1_0, url, xml, cookies)<EOL><DEDENT>elif version == '<STR_LIT>':<EOL><INDENT>return wcs111.WebCoverageService_1_1_1.__new__(wcs111.WebCoverageService_1_1_1, url, xml, cookies)<EOL><DEDENT>elif version == '<STR_LIT>':<EOL><INDENT>return wcs200.WebCoverageService_2_0_0.__new__(wcs200.WebCoverageService_2_0_0, url, xml, cookies)<EOL><DEDENT>elif version == '<STR_LIT>':<EOL><INDENT>return wcs201.WebCoverageService_2_0_1.__new__(wcs201.WebCoverageService_2_0_1, url, xml, cookies)<EOL><DEDENT>
wcs factory function, returns a version specific WebCoverageService object