@staticmethod
def truncate_string(str_to_truncate, max_num):
    """Truncate a string by taking first and last characters.

        :param str_to_truncate: the string to be truncated -- str
        :param max_num: the maximum number of characters -- int
        :returns: truncated string or original string -- str
        """
    if len(str_to_truncate) > max_num:
        new_num = len(str_to_truncate) - max_num // 2
        first_chars = str_to_truncate[:max_num // 2]
        last_chars = str_to_truncate[new_num:]
        str_to_truncate = first_chars + last_chars
    return str_to_truncate
