+def header(title: str, *, width: int = 80, color: str = ''):
+ """
+ Returns a nice header line with a title.
+
+ >>> header('title', width=60, color='')
+ '----[ title ]-----------------------------------------------'
+
+ """
+ w = width
+ w -= len(title) + 4
+ if w >= 4:
+ left = 4 * '-'
+ right = (w - 4) * '-'
+ if color != '' and color is not None:
+ r = reset()
+ else:
+ r = ''
+ return f'{left}[ {color}{title}{r} ]{right}'
+ else:
+ return ''
+
+