def build_array(lib, typ, size, vals=None):
    """Build an array of the specified type and the specified size.

    Parameters
    ----------

    lib : CLibrary
        Reference to the library with which this object will be used. This is
        needed as the way to build the array depends on the backend.

    type : type or string
        Type object or string which will be used to determine the type of
        the array elements.

    size : int or tuple
        Dimensions of the array to create.

    vals : list, optional
        Initial values with which to fill the array.

    """
    return lib._get_array(typ, size, vals)
