def get_fixed_length_string(string: str, length=20) -> str:
    """
    Add spacing to the end of the string so it's a fixed length, or truncate
    if it's too long.
    """
    if len(string) > length:
        return f"{string[: length - 3]}..."
    spacing = "".join(" " for _ in range(length - len(string)))
    return f"{string}{spacing}"


def print_heading(string: str, width: int = 64) -> None:
    """
    Prints out a nicely formatted heading to the console. Useful for breaking
    up the output in large CLI commands.
    """
    print(f"\n{string.upper():^{width}}")
    print("-" * width)
