def _cast_common_type(*xs): dtypes = [x.dtype for x in xs if x is not None] dtype = numpy.find_common_type(dtypes, []) return [x.astype(dtype) if x is not None and x.dtype != dtype else x for x in xs]