code: def gdal2np_dtype(b):
      
      dt_dict = gdal_array.codes
      if isinstance(b, str):
          b = gdal.Open(b)
      if isinstance(b, gdal.Dataset):
          b = b.GetRasterBand(1)
      if isinstance(b, gdal.Band):
          b = b.DataType
      if isinstance(b, int):
          np_dtype = dt_dict[b]
      else:
          np_dtype = None
          print("Input must be GDAL Dataset or RasterBand object")
      return np_dtype
docs: Get NumPy datatype that corresponds with GDAL RasterBand datatype
      Input can be filename, GDAL Dataset, GDAL RasterBand, or GDAL integer dtype