def pad_string(string: str, length: int) -> str:
    """Pads a string to specified length.

    Args:
        string: the text string to be padded with spaces
        length: the length of the returned string

    Returns:
        A string exactly length characters long.

    This is a helper function to hide the messy ljust()[] syntax, which is
    needed many places in pyfind because of the re-use of a single console
    line for running status information about which folders are being searched.
    """
    return string[:length].ljust(length)