from typing import Collection


def collec_same_shape(collec_1:Collection, collec_2:Collection) -> bool:
    """
    Check if two collection objects have the same shape, meaning that all
    matching lists have the same length and all matching dicts have the same
    keys. This takes into account empty internal collections as well.
    """
    if isinstance(collec_1, list):
        if not isinstance(collec_2, list):
            return False
        if not len(collec_1) == len(collec_2):
            return False
        return all(collec_same_shape(elt_1, elt_2) for elt_1, elt_2 in zip(collec_1, collec_2))
    elif isinstance(collec_1, dict):
        if not isinstance(collec_2, dict):
            return False
        if not sorted(collec_1.keys()) == sorted(collec_2.keys()):
            return False
        return all(collec_same_shape(collec_1[k], collec_2[k]) for k in collec_1.keys())
    else:
        if isinstance(collec_2, (list, dict)):
            return False
        return True