def header(titles, spacing=20, underline='-'):
    """Return a title header as a string."""
    header = ' '.join([
        ('{0:<' + str(spacing) + '}').format(title, spacing)
        for title in titles]
    )

    return header + '\n' + underline * len(header)