def truncate(text="", max_len=50):
    """
    Ensure a string complies to the maximum length specified.

    :param text: Text to be checked for length and truncated if necessary
    :type text: str
    :param max_len: Max length of the returned string
    :type max_len: int, optional
    :return: Text in :param text: truncated to :param max_len: if necessary
    :rtype: str
    """
    return text if len(text) < max_len else text[:max_len]