import re


def is_valid_attr_name(s: str) -> bool:
    """
    Ensure the given string can be used as attribute on an object instance.
    """
    return bool(
        isinstance(s, str) and re.search(string=s, pattern=r"^[a-zA-Z_][a-zA-Z0-9_]*$")
    )