<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def interactions_per_snapshots(self, t=None):
 """Return the number of interactions within snapshot t. Parameters t : snapshot id (default=None) If None will be returned total number of interactions across all snapshots Returns ------- nd : dictionary, or number A dictionary with snapshot ids as keys and interaction count as values or a number if a single snapshot id is specified. Examples -------- 3 {0: 3, 1: 3, 2: 3} """

        if t is None:
            return {k: v / 2 for k, v in self.snapshots.items()}
        else:
            try:
                return self.snapshots[t] / 2
            except KeyError:
                return 0