def dtype(element):
    """
        Return the dtype of an array or the type of the element.
    """
    if hasattr(element, 'dtype'):
        return element.dtype
    else:
        return type(element)
