def string_to_class_name(string):

    # capitalize first letter
    string = re.sub(r'[A-Za-z]', lambda m: m.group().title(), string, count=1)

    # replace `*_<c>` with `*<C>` E.g., `Error_x` --> `ErrorX`
    string = re.sub(r'_[A-Za-z0-9]+', lambda m: m.group()[1:].title(), string)

    return str(string)
Single function to handle turning object names into class names.
dataset/ETHPy150Open plotly/plotly.py/plotly/graph_reference.py/string_to_class_name