def getParentKeyAtLevel(key:str, desiredLevel:int) -> str:
    """
        >>> getParentKeyAtLevel('Rocket.Sustainer.Nosecone.mass', 0)
        'Rocket'
        >>> getParentKeyAtLevel('Rocket.Sustainer.Nosecone.mass', 1)
        'Rocket.Sustainer'
        >>> getParentKeyAtLevel('Rocket.Sustainer.Nosecone.mass', 2)
        'Rocket.Sustainer.Nosecone'
    """
    desiredParts = key.split('.')[0:desiredLevel+1]
    return '.'.join(desiredParts)