def validate(value): try: validate.url_path(value) except exceptions.InvalidURLPath: error = 'Value must be a valid URL Path string' raise ValueError(error) return value