import re


def get_param_name(param, file, line):
    """
    Grab the parameter name from a line in the log file.

    Returns a string.
    """
    # Replace any bad characters
    repl = [("#", "")]
    for a, b in repl:
        param = param.replace(a, b)

    # Search for a match
    match = re.search(r"\((.*?)\)", param)
    if match:
        param = match.groups()[0]
        # If the param name starts with a number,
        # add an underscore so we can make it a
        # valid class property name
        if any(param.startswith(str(n)) for n in range(10)):
            param = "_" + param
        return param
    else:
        # There is no (ParameterName) here.
        # This is therefore not a variable, but a setting.
        # If there are spaces, get rid of them and force title case
        if " " in param:
            param = param.title().replace(" ", "")
        return param