import re


def safe_htcondor_attribute(attribute: str) -> str:
    """Convert input attribute name into a valid HTCondor attribute name

    HTCondor ClassAd attribute names consist only of alphanumeric characters or
    underscores.  It is not clearly documented, but the alphanumeric characters
    are probably restricted to ASCII.  Attribute names created from multiple
    words typically capitalize the first letter in each word for readability,
    although all comparisions are case-insensitive.

    e.g., "central-manager" -> "CentralManager"

    Args:
      attribute: a string representing the name of an attribute

    Returns:
      The attribute name stripped of invalid characters and re-capitalized in
      the manner typical of HTCondor ClassAd attributes.

    Raises:
      None
    """
    # splitting by invalid characters removes them from the resulting array
    split_attr = re.split(r"[^\w]", attribute, flags=re.ASCII)
    safe_attr = "".join([word.capitalize() for word in split_attr if word])
    return safe_attr