human
Complete the below
def client_requests_text_rewrite(raw_text):

    ''''Rewrite proxy domain to origin domain, extdomains supported.
    Also Support urlencoded url.
    This usually used in rewriting request params
    eg. http://foo.bar/extdomains/accounts.google.com to http://accounts.google.com
    eg2. foo.bar/foobar to www.google.com/foobar
    eg3. http%3a%2f%2fg.zju.tools%2fextdomains%2Faccounts.google.com%2f233
    to http%3a%2f%2faccounts.google.com%2f233
    :type raw_text: str
    :rtype: str'
    '''

=====
What is a the Python code you requested?
assistant
#Here is the Python code you requested.
    def replace_to_real_domain(match_obj):
        scheme = get_group('scheme', match_obj)
        colon = match_obj.group('colon')
        scheme_slash = get_group('scheme_slash', match_obj)
        _is_https = bool(get_group('is_https', match_obj))
        real_domain = match_obj.group('real_domain')
        result = ''
        if scheme:
            if ('http' in scheme):
                if (_is_https or is_target_domain_use_https(real_domain)):
                    result += ('https' + colon)
                else:
                    result += ('http' + colon)
            result += (scheme_slash * 2)
        result += real_domain
        return result
    replaced = regex_request_rewriter_extdomains.sub(replace_to_real_domain, raw_text)
    if ((developer_string_trace is not None) and (developer_string_trace in replaced)):
        infoprint('StringTrace:    appears    client_requests_text_rewrite,    code    line    no.    ', current_line_number())
    replaced = regex_request_rewriter_main_domain.sub(target_domain, replaced)
    replaced = replaced.replace(my_host_name, target_domain)
    dbgprint('ClientRequestedUrl:    ', raw_text, '<-    Has    Been    Rewrited    To    ->', replaced)
    return replaced