def get_shape(obj):
    """
    Get the shape of a :code:'numpy.ndarray' or of a nested list.

    Parameters(obj):
       obj: The object of which to determine the shape.

    Returns:

        A tuple describing the shape of the :code:`ndarray` or the
        nested list or :code:`(1,)`` if obj is not an instance of either
        of these types.

    """
    if hasattr(obj, "shape"):
        return obj.shape
    elif type(obj) == list:
        if obj == []:
            return (0,)
        else:
            return (len(obj),) + get_shape(obj[0])
    else:
        return ()