<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def split_url(self, url):
 """Parse an IIIF API URL path into components. Will parse a URL or URL path that accords with either the parametrized or info API forms. Will raise an IIIFRequestError on failure. If self.identifier is set then url is assumed not to include the identifier. """

        # clear data first
        identifier = self.identifier
        self.clear()
        # url must start with baseurl if set (including slash)
        if (self.baseurl is not None):
            (path, num) = re.subn('^' + self.baseurl, '', url, 1)
            if (num != 1):
                raise IIIFRequestError(
                    text="Request URL does not start with base URL")
            url = path
        # Break up by path segments, count to decide format
        segs = url.split('/')
        if (identifier is not None):
            segs.insert(0, identifier)
        elif (self.allow_slashes_in_identifier):
            segs = self._allow_slashes_in_identifier_munger(segs)
        # Now have segments with identifier as first
        if (len(segs) > 5):
            raise IIIFRequestPathError(
                text="Request URL (%s) has too many path segments" % url)
        elif (len(segs) == 5):
            self.identifier = urlunquote(segs[0])
            self.region = urlunquote(segs[1])
            self.size = urlunquote(segs[2])
            self.rotation = urlunquote(segs[3])
            self.quality = self.strip_format(urlunquote(segs[4]))
            self.info = False
        elif (len(segs) == 2):
            self.identifier = urlunquote(segs[0])
            info_name = self.strip_format(urlunquote(segs[1]))
            if (info_name != "info"):
                raise IIIFRequestError(
                    text="Bad name for Image Information")
            if (self.api_version == '1.0'):
                if (self.format not in ['json', 'xml']):
                    raise IIIFRequestError(
                        text="Invalid format for Image Information (json and xml allowed)")
            elif (self.format != 'json'):
                raise IIIFRequestError(
                    text="Invalid format for Image Information (only json allowed)")
            self.info = True
        elif (len(segs) == 1):
            self.identifier = urlunquote(segs[0])
            raise IIIFRequestBaseURI()
        else:
            raise IIIFRequestPathError(
                text="Bad number of path segments in request")
        return(self)