from typing import Optional


def expand_portname(portname: str) -> Optional[str]:
    """
    Given a port name with a abbreviated prefix, expand the prefix.
    Fa -> FastEthernet
    Gi -> GigabitEthernet
    Te -> TenGigabitEthernet
    """
    if not portname:
        return None
    if portname.startswith("Fa") and not portname.startswith("FastEthernet"):
        return f"FastEthernet{portname[2:]}"
    if portname.startswith("Gi") and not portname.startswith("GigabitEthernet"):
        return f"GigabitEthernet{portname[2:]}"
    if portname.startswith("Te") and not portname.startswith("TenGigabitEthernet"):
        return f"TenGigabitEthernet{portname[2:]}"
    return portname