<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_appliance_stats_by_location(self, location_id, start, end, granularity=None, per_page=None, page=None, min_power=None):
 """Get appliance usage data for a given location within a given time range. Stats are generated by fetching appliance events that match the supplied criteria and then aggregating them together based on the granularity specified with the request. Note: This endpoint uses the location's time zone when generating time intervals for the stats, which is relevant if that time zone uses daylight saving time (some days will be 23 or 25 hours long). Args: location_id (string):
 hexadecimal id of the sensor to query, e.g. ``0x0013A20040B65FAD`` start (string):
 ISO 8601 start time for getting the events of appliances. end (string):
 ISO 8601 stop time for getting the events of appliances. Cannot be larger than 1 month from start time granularity (string):
 granularity of stats. If the granularity is 'unknown', the stats for the appliances between the start and end time is returned.; must be one of "minutes", "hours", "days", "weeks", "months", or "unknown" (default: days) min_power (string):
 The minimum average power (in watts) for filtering. Only events with an average power above this value will be returned. (default: 400) per_page (string, optional):
 the number of returned results per page (min 1, max 500) (default: 10) page (string, optional):
 the page number to return (min 1, max 100000) (default: 1) Returns: list: dictionary objects containing appliance events meeting specified criteria """

    url = "https://api.neur.io/v1/appliances/stats"

    headers = self.__gen_headers()
    headers["Content-Type"] = "application/json"

    params = {
      "locationId": location_id,
      "start": start,
      "end": end
    }
    if granularity:
      params["granularity"] = granularity
    if min_power:
      params["minPower"] = min_power
    if per_page:
      params["perPage"] = per_page
    if page:
      params["page"] = page
    url = self.__append_url_params(url, params)

    r = requests.get(url, headers=headers)
    return r.json()