<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _convert_to_array(x, size, name):
 """Check length of array or convert scalar to array. Check to see is `x` has the given length `size`. If this is true then return Numpy array equivalent of `x`. If not then raise ValueError, using `name` as an idnetification. If len(x) returns TypeError, then assume it is a scalar and create a Numpy array of length `size`. Each item of this array will have the value as `x`. """

    try:
        l = len(x)
        if l != size:
            raise ValueError(
                "{0} must be scalar or of length {1}".format(
                    name, size))
    except TypeError:
        # Only one item
        xa = np.array([x] * size)  # Each item is a diff. object.
    else:
        xa = np.array(x)

    return xa