How to export a basemap to GeoTIFF using ArcPy

filename = r'p:\basemap.tif'
width = 1024
height = 1024

# export the active map to geotiff
arcpy.mp.ArcGISProject('CURRENT').activeMap.defaultView.exportToTIFF(filename, width, height, geoTIFF_tags=True)