def _parse_layer(layer, return_wms_name=False):
        """ Helper function for parsing Geopedia layer name. If WMS name is required and wrong form is given it will
        return a string with 'ttl' at the beginning. (WMS name can also start with something else, e.g. only 't'
        instead 'ttl', therefore anything else is also allowed.) Otherwise it will parse it into a number.
        """
        if not isinstance(layer, (int, str)):
            raise ValueError("Parameter 'layer' should be an integer or a string, but {} found".format(type(layer)))

        if return_wms_name:
            if isinstance(layer, int) or layer.isdigit():
                return 'ttl{}'.format(layer)
            return layer

        if isinstance(layer, str):
            stripped_layer = layer.lstrip('tl')
            if not stripped_layer.isdigit():
                raise ValueError("Parameter 'layer' has unsupported value {}, expected an integer".format(layer))
            layer = stripped_layer

        return int(layer)
def _parse_layer ( layer , return_wms_name = False ) : if not isinstance ( layer , ( int , str ) ) : raise ValueError ( "Parameter 'layer' should be an integer or a string, but {} found" . format ( type ( layer ) ) ) if return_wms_name : if isinstance ( layer , int ) or layer . isdigit ( ) : return 'ttl{}' . format ( layer ) return layer if isinstance ( layer , str ) : stripped_layer = layer . lstrip ( 'tl' ) if not stripped_layer . isdigit ( ) : raise ValueError ( "Parameter 'layer' has unsupported value {}, expected an integer" . format ( layer ) ) layer = stripped_layer return int ( layer )
Helper function for parsing Geopedia layer name. If WMS name is required and wrong form is given it will
        return a string with 'ttl' at the beginning. (WMS name can also start with something else, e.g. only 't'
        instead 'ttl', therefore anything else is also allowed.) Otherwise it will parse it into a number.