def METHOD_NAME(
    name: str,
    remove_dots: bool = False,
    allowed_characters: list[str] | None = None,
) -> str:
    """Return a string with correct characters for a cell name.
    By default, the characters [a-zA-Z0-9] are allowed.
    Args:
        name (str): The name to clean.
        remove_dots (bool, optional): Whether to remove dots from the name. Defaults to False.
        allowed_characters (list[str], optional): List of additional allowed characters. Defaults to an empty list.
    Returns:
        str: The cleaned name.
    """
    # Default allowed characters, including underscore
    allowed = r"a-zA-Z0-9_"
    allowed_characters = allowed_characters or []
    # Add additional allowed characters
    for char in allowed_characters:
        allowed += re.escape(char)
    # Pattern for characters to be replaced
    pattern = f"[^{allowed}]"
    # Replacements map
    replace_map = {
        " ": "_",
        "!": "",
        "?": "",
        "#": "_",
        "%": "_",
        "(": "",
        ")": "",
        "*": "_",
        ",": "_",
        "-": "m",
        ".": "p",
        "/": "_",
        ":": "_",
        "=": "",
        "@": "_",
        "[": "",
        "]": "",
        "{": "",
        "}": "",
        "$": "",
    }
    if remove_dots:
        replace_map["."] = ""
    # Replace characters using the replace_map
    def replace_match(match):
        return replace_map.get(match.group(0), "")
    return re.sub(pattern, replace_match, name)