def trim_text(text, max_len):
    """
    Trim input text to fit the `max_len` condition.

    If trim is needed: keep the first 1/3rd of the budget on the top,
    and the other 2 thirds on the bottom.
    """
    if len(text) <= max_len:
        return text
    trimmed_text = (
        u'{top_third}\n```\n*...trimmed...*\n```\n{bottom_two_third}\n'.
        format(top_third=text[:max_len / 3], bottom_two_third=text[len(text
        ) - 2 * max_len / 3:]))
    return trimmed_text
