<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mouse(table, day=None):

 """Handler for showing mouse statistics for specified type and day."""

    where = (("day", day),) if day else ()
    events = db.fetch(table, where=where, order="day")
    for e in events: e["dt"] = datetime.datetime.fromtimestamp(e["stamp"])
    stats, positions, events = stats_mouse(events, table)
    days, input = db.fetch("counts", order="day", type=table), "mouse"
    return bottle.template("heatmap.tpl", locals(), conf=conf)