Sorts the counter and keeps only the most common items up to
        ``truncation_length`` in place.

        :type truncation_length: int

def truncate_most_common(self, truncation_length):
        '''
        Sorts the counter and keeps only the most common items up to
        ``truncation_length`` in place.

        :type truncation_length: int
        '''
        keep_keys = set(v[0] for v in self.most_common(truncation_length))
        for key in self.keys():
            if key not in keep_keys:
                self.pop(key)