Cherry-Picked Arne's DataType_Factory