code: def weather(searchterm):
      
      unit = "si" if os.environ.get("WEATHER_CELSIUS") else "us"
  
      geo = requests.get(
          "https://api.mapbox.com/geocoding/v5/mapbox.places/{}.json?limit=1&access_token={}".format(
              quote(searchterm.encode("utf8")), MAPBOX_API_TOKEN
          )
      ).json()
      citystate = geo["features"][0]["place_name"]
      lon, lat = geo["features"][0]["center"]
      forecast = requests.get(
          "https://api.darksky.net/forecast/{}/{},{}?unit={}".format(
              DARKSKY_API_KEY, lat, lon, unit
          )
      ).json()
  
      title = "Weather for {}: ".format(citystate)
  
      forecasts = []
      unit_abbrev = "f" if unit == "us" else "c"
      for day in forecast["daily"]["data"][0:4]:
          day_of_wk = datetime.fromtimestamp(day["time"]).strftime("%A")
          icon = ICONMAP.get(day["icon"], ":question:")
          forecasts.append(
              {
                  "title": day_of_wk,
                  "value": u"{} {}°{}".format(
                      icon, int(round(day["temperatureHigh"])), unit_abbrev
                  ),
                  "short": True,
              }
          )
  
      return title, forecasts
docs: Get the weather for a place given by searchterm
  
      Returns a title and a list of forecasts.
  
      The title describes the location for the forecast (i.e. "Portland, ME USA")
      The list of forecasts is a list of dictionaries in slack attachment fields
          format (see https://api.slack.com/docs/message-attachments)
  
      Throws WeatherException if the location given by `searchterm` can't be
      found.