def c_array(py_array, c_type):
    """Makes a C array from a python list or array and a C datatype

    Arguments
    ----------
      py_array: array-like data to convert
      c_type: C datatype to which elements of py_array will be converted

    Returns
    -------
    C array of chosen datatype
    """
    if not isinstance(py_array, list):
        pya = list(py_array)
    else:
        pya = py_array
    return (c_type * len(pya))(*pya)