<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pattern2re(pattern):
 """Makes a unicode regular expression from a pattern. Returns ``(start, full_re, int_re)`` where: * `start` is either empty or the subdirectory in which to start searching, * `full_re` is a regular expression object that matches the requested files, i.e. a translation of the pattern * `int_re` is either None of a regular expression object that matches the requested paths or their ancestors (i.e. if a path doesn't match `int_re`, no path under it will match `full_re`) This uses extended patterns, where: * a slash '/' always represents the path separator * a backslash '\' escapes other special characters * an initial slash '/' anchors the match at the beginning of the (relative) path * a trailing '/' suffix is removed * an asterisk '*' matches a sequence of any length (including 0) of any characters (except the path separator) * a '?' matches exactly one character (except the path separator) * '[abc]' matches characters 'a', 'b' or 'c' * two asterisks '**' matches one or more path components (might match '/' characters) """

    pattern_segs = filter(None, pattern.split('/'))

    # This anchors the first component either at the start of the string or at
    # the start of a path component
    if not pattern:
        return '', re.compile(''), None
    elif '/' in pattern:
        full_regex = '^'  # Start at beginning of path
        int_regex = []
        int_regex_done = False
        start_dir = []
        start_dir_done = False
    else:
        full_regex = '(?:^|/)'  # Skip any number of full components
        int_regex = None
        int_regex_done = True
        start_dir = []
        start_dir_done = True

    # Handles each component
    for pnum, pat in enumerate(pattern_segs):
        comp = patterncomp2re(pat)

        # The first component is already anchored
        if pnum > 0:
            full_regex += '/'
        full_regex += comp

        if not int_regex_done:
            if pat == '**':
                int_regex_done = True
            else:
                int_regex.append(comp)
                if not start_dir_done and no_special_chars.match(pat):
                    start_dir.append(pat)
                else:
                    start_dir_done = True

    full_regex = re.compile(full_regex.rstrip('/') + '$')
    if int_regex is not None:
        n = len(int_regex)
        int_regex_s = ''
        for i, c in enumerate(reversed(int_regex)):
            if i == n - 1:  # Last iteration (first component)
                int_regex_s = '^(?:%s%s)?' % (c, int_regex_s)
            elif int_regex_s:
                int_regex_s = '(?:/%s%s)?' % (c, int_regex_s)
            else:  # First iteration (last component)
                int_regex_s = '(?:/%s)?' % c
        int_regex = re.compile(int_regex_s + '$')
    start_dir = '/'.join(start_dir)
    return start_dir, full_regex, int_regex