from typing import Union


def convert_indent(text: str, old_indent: Union[int, str], new_indent: Union[int, str]) -> str:
    """
    Changes the indent of the lines in a text.

    Note: empty lines will be unaffected.

    Args:
        text: The text to be processed.
        old_indent: The indent to remove, given either as a number of columns, or a specific string
        new_indent: The indent to add, given either as a number of columns, or a specific string

    Returns:
        The text with the indent replaced.
    """

    if isinstance(old_indent, int):
        old_indent = ' ' * old_indent
    if isinstance(new_indent, int):
        new_indent = ' ' * new_indent

    def _convert_line(line):
        if line == '' or line == '\n':
            return line

        assert line.startswith(old_indent), "All text should start with the same indent sequence"

        return new_indent + line[len(old_indent):]

    return ''.join(_convert_line(line) for line in text.splitlines(True))