def class_size(cls):
    """Get the number of bytes per element for a given data type.

    Parameters:
    cls (str): Name of the data type

    Returns:
    int: Number of byte per element

   """

    if cls in ['float64', 'int64', 'uint64']:
        n_byte = 8
    elif cls in ['float32', 'int32', 'uint32']:
        n_byte = 4
    elif cls in ['bool', 'str', 'int8', 'uint8']:
        n_byte = 1
    else:
        raise TypeError('invalid data type')

    return n_byte