def _get_timeinfo(arr, datepart, fullsize, tzname):
    """Convert the months/hours array provided into label text and SQL

    Args:
      arr (list): A list of ints
      datepart (str): the part to extract from the database timestamp
      fullsize (int): the size of specifying all dates
      tzname (str): The timezone to compute this limiter in.

    Returns:
      dict with keys `sqltext` and `labeltext`
    """
    sql = ""
    lbl = "All included"
    if len(arr) == 1:
        sql = " and extract(%s from valid%s) = %s " % (
            datepart,
            "" if tzname is None else " at time zone '%s'" % (tzname,),
            arr[0],
        )
        lbl = str(tuple(arr))
    elif len(arr) < fullsize:
        sql = (" and extract(%s from valid%s) in %s ") % (
            datepart,
            "" if tzname is None else " at time zone '%s'" % (tzname,),
            (str(tuple(arr))).replace("'", ""),
        )
        lbl = str(tuple(arr))
    return dict(sqltext=sql, labeltext=lbl)