from typing import List


def clean_source(source: List[str]) -> List[str]:
    """
    Cleans the source content of a Synapse notebook cell.

    :param source: The source content of the cell.
    :returns: The cleaned source content of the cell.
    """
    source = list([line.rstrip() for line in source])
    source = "\n".join(source).strip().split("\n")
    source = list([f"{line}\n" for line in source])

    # remove new line in last line
    if source:
        source[-1] = source[-1].rstrip("\n")

    return source