docs: def metadata(dataset, node, entityids, extended=False, api_key=None):
      """
      Request metadata for a given scene in a USGS dataset.
  
      :param dataset:
      :param node:
      :param entityids:
      :param extended:
          Send a second request to the metadata url to get extended metadata on the scene.
      :param api_key:
      """
      api_key = _get_api_key(api_key)
  
      url = '{}/metadata'.format(USGS_API)
      payload = {
          "jsonRequest": payloads.metadata(dataset, node, entityids, api_key=api_key)
      }
      r = requests.post(url, payload)
      response = r.json()
  
      _check_for_usgs_error(response)
  
      if extended:
          metadata_urls = map(_get_metadata_url, response['data'])
          results = _async_requests(metadata_urls)
          data = map(lambda idx: _get_extended(response['data'][idx], results[idx]), range(len(response['data'])))
  
      return response