def screen_header(text: str, decor: str='=', max: int=79) ->str:
    """Return a header to be displayed on screen, by decorating ``text``."""
    text = str(text)
    available = max - len(text)
    if available > 3:
        text = '  ' + text + '  '
        available -= 4
    else:
        return text
    req_space = len(decor) * 2
    while available >= req_space:
        text = decor + text + decor
        available -= req_space
        if len(text) == available - len(decor):
            text += decor
            available -= len(decor)
    return text
