from typing import Optional
import re


def remove_column_from_location(location: Optional[str]) -> Optional[str]:
    """
    Remove column number from source location string.
    For strings like "path/to/file.cpp:20:56".
    Return str line "path/to/file.cpp:20" or
    input location if column info can not be removed."
    """
    if not location:
        return location

    re_line_column = re.compile(r"^(.*?):(\d+)(?::\d+)?$")
    return re.sub(re_line_column, r"\1:\2", location)