Creates new geotiff from array

def create_geotiff(name, Array, driver, ndv, xsize, ysize, geot, projection, datatype, band=1):
    '''
    Creates new geotiff from array
    '''
    if isinstance(datatype, np.int) == False:
        if datatype.startswith('gdal.GDT_') == False:
            datatype = eval('gdal.GDT_'+datatype)
    newfilename = name+'.tif'
    # Set nans to the original No Data Value
    Array[np.isnan(Array)] = ndv
    # Set up the dataset
    DataSet = driver.Create(newfilename, xsize, ysize, 1, datatype)
    # the '1' is for band 1.
    DataSet.SetGeoTransform(geot)
    DataSet.SetProjection(projection.ExportToWkt())
    # Write the array
    DataSet.GetRasterBand(band).WriteArray(Array)
    DataSet.GetRasterBand(band).SetNoDataValue(ndv)
    return newfilename