import re


def process_location(class_location: str, useless_part: re.Pattern) -> str:
    """Remove unnecessary part from the location string.

    This function's main purpose is to remove the stuff inside (and including)
    brackets from locations like: ATB212 (27) CL, IB303(26), ATB310(25 )B, etc

    Parameters
    ----------
    class_location : str
        where the class is going to be held

    Returns
    -------
    str
        the location without the unnecessary part

    >>> process_location("ATB212 (27) CL", KILL_BRACKETS_RE)
    "ATB212 CL"
    """

    match = re.search(useless_part, class_location)

    if match:
        start, end = match.span()
        class_location = class_location[:start] + class_location[end:]

    return class_location