def get_naip_tnm_url(xmin, ymin, xmax, ymax,
                     bbox_epsg=3857,
                     img_epsg=3857,
                     img_format='jpgpng',
                     width=500, height=500):
  """
  Returns the URL for making a request to get an image from The National Map's
  NAIP REST service.

  Parameters
  ----------
  minx, miny, maxx, maxy : numeric
    the coordinates of the bounding box of the image to return, assumed to be
    in coordinate reference system EPSG:3857
  img_format : string
    image format to request, valid options are 'jpg', 'jpgpng', 'png', 'png8',
    'png24', 'png32', 'bmp', 'gif', 'tiff'.


  Returns
  -------
  url : string
    the url that will return the NAIP image
  """

  url = ''.join(['https://services.nationalmap.gov/arcgis/rest/services/',
  'USGSNAIPImagery/ImageServer/exportImage?',
  'bbox={}%2C{}%2C{}%2C{}&'.format(xmin, ymin, xmax, ymax),
  'bboxSR={}&'.format(bbox_epsg),
  'size={}%2C{}&'.format(width, height),
  'imageSR={}&'.format(img_epsg),
  'time=&',
  'format={}&'.format(img_format),
  'pixelType=U8&',
  'noData=&',
  'noDataInterpretation=esriNoDataMatchAny&',
  'interpolation=+RSP_BilinearInterpolation&'
  'compression=&',
  'compressionQuality=&',
  'bandIds=&',
  'mosaicRule=&',
  'renderingRule=&',
  'f=image'])

  return url