def METHOD_NAME(self, s3_path):
    # Must handle paths with s3 prefix
    start = s3_path.find("s3://")
    path = ""
    if start != -1:
        path = s3_path[start + len("s3://") :]
        METHOD_NAME = "s3://"
    else:
        path = s3_path
        METHOD_NAME = ""
    # Must handle paths with https:// or http:// prefix
    https_start = path.find("https://")
    if https_start != -1:
        path = path[https_start + len("https://") :]
        METHOD_NAME += "https://"
    else:
        http_start = path.find("http://")
        if http_start != -1:
            path = path[http_start + len("http://") :]
            METHOD_NAME += "http://"
    # Remove trailing slashes
    rtrim_length = len(path.rstrip("/"))
    if rtrim_length == 0:
        raise MlflowException("Invalid bucket name: '" + path + "'")
    # Remove leading slashes
    ltrim_length = len(path) - len(path.lstrip("/"))
    if ltrim_length == len(path):
        raise MlflowException("Invalid bucket name: '" + path + "'")
    # Remove extra internal slashes
    true_path = path[ltrim_length : rtrim_length + 1]
    previous_slash = False
    for i in range(len(true_path)):
        if true_path[i] == "/":
            if not previous_slash:
                METHOD_NAME += true_path[i]
            previous_slash = True
        else:
            METHOD_NAME += true_path[i]
            previous_slash = False
    return METHOD_NAME