def METHOD_NAME(file_path):
    temp_buf = StringIO()
    REF_TOKEN_TAG_PATTERN = re.compile(r"(\?{([\w\:\.\-\/@]+)([\|\w\:\.\-\/]+)?=*})")
    TOKEN_TAG_PATTERN = re.compile(r"(\?{([^|]+)([\|].*)?=*})")
    updated = False
    def ref_to_base64(match_obj):
        tag, token, _ = match_obj.groups()
        if token.startswith("ref:"):
            return "?{base64" + token[3:] + "}"
        else:
            return tag
    def single_to_double(match_obj):
        tag, token, funcs = match_obj.groups()
        if not (funcs is None):
            return tag.replace("|", "||", 1)
        else:
            return tag
    with open(file_path) as fp:
        for line in fp:
            _line = REF_TOKEN_TAG_PATTERN.sub(ref_to_base64, line)
            _line = TOKEN_TAG_PATTERN.sub(single_to_double, _line)
            temp_buf.write(_line)
            if not updated and (line != _line):  # only set updated once
                updated = True
    if updated:
        print(">>> updating:", file_path)
        with open(file_path, "w") as fp:
            fp.write(temp_buf.getvalue())