def cast_scalar_to_array(shape, value, dtype=None):
if dtype is None:<EOL><INDENT>dtype, fill_value = infer_dtype_from_scalar(value)<EOL><DEDENT>else:<EOL><INDENT>fill_value = value<EOL><DEDENT>values = np.empty(shape, dtype=dtype)<EOL>values.fill(fill_value)<EOL>return values<EOL>
create np.ndarray of specified shape and dtype, filled with values

Parameters
----------
shape : tuple
value : scalar value
dtype : np.dtype, optional
    dtype to coerce

Returns
-------
ndarray of shape, filled with value, of specified / inferred dtype