from typing import List
from typing import Dict


def firstLine(col_lengths: List[int], border: Dict[str, str], extra_spaces: int = 2) -> str:
    """ Create the first line of the table (the upper border)
    Args:
        col_lengths (List[int]): the char length of each comlumn as a list of int.
        border (Dict[str, str]): the border dictionary.
        extra_spaces (int, optional): The extra length added to each column's length. Defaults to 2.
    Returns:
        str: The first line of the table (the upper border).
    """
    # sourcery skip: inline-immediately-returned-variable, simplify-len-comparison
    if len(col_lengths) < 1:
        return ""
    _line = border["tl"]
    for col_length in col_lengths:
        _line += border["h"] * (col_length + extra_spaces)
        _line += border["tc"]
    # now replace the right corner with the appropriate one
    _line = _line[:-1] + border["tr"]
    return _line