def dirhandler(directory, defaultdir):
    """
    If directory is None, turn it into defaultdir.

    :param directory: Target directory.
    :type directory: str

    :param defaultdir: Default directory.
    :type defaultdir: str
    """
    directory = defaultdir if directory is None else directory
    return directory
