def output_notebook(name: str, input: str) -> str:
    """Generate name for output notebook.

    If an output name is given it is returned as it is. Otherwise, the name
    of the input notebook will have the suffix ``.ipynb`` replaced by ``.out.ipynb``.
    If the input notebook does not have a suffix ``.ipynb`` the suffix  ``.out.ipynb``
    is appended to the input notebook name.

    Parameters
    ----------
    name: string
        User-provided name for the output notebook. This value may be None.
    input: string
        Name of the input notebook.

    Returns
    -------
    string
    """
    if name:
        return name
    return input[:-6] + '.out.ipynb' if input.endswith('.ipynb') else input + '.out.ipynb'