code: def get_top_n_action_types(self, top_n):
          
          # Count action types
          action_type_to_counts = dict()
          for action in self.actions:
              actiontype = action.actiontype
              if actiontype not in action_type_to_counts:
                  action_type_to_counts[actiontype] = 1
              else:
                  action_type_to_counts[actiontype] = \
                          action_type_to_counts[actiontype] + 1
  
          # Convert the dictionary representation into a pair of lists
          action_types = list()
          counts = list()
          for actiontype in action_type_to_counts.keys():
              action_types.append(actiontype)
              counts.append(action_type_to_counts[actiontype])
  
          # How many actions in total?
          num_actions = len(self.actions)
          num_actions2 = 0
          for count in counts:
              num_actions2 = num_actions2 + count
          if num_actions != num_actions2:
              raise(Exception('Problem counting everything up!'))
  
          # Sort action types by count (lowest to highest)
          sorted_inds = np.argsort(counts)
          last_ind = len(sorted_inds)-1
  
          # Return the top N actions
          top_actions = list()
          if top_n > len(sorted_inds):
              raise Exception('Asked for top %d action types, ' +
                              'but there are only %d action types'
                              % (top_n, len(sorted_inds)))
          for i in range(top_n):
              top_actions.append(action_types[sorted_inds[last_ind-i]])
          return top_actions
docs: Returns the top N actions by count.