from typing import Optional


def format_drivername(dialect: str, driver: Optional[str] = None):
    """Helper function to format the schema part of connection strings.

    Args:
        dialect (str): Database dialect.
        driver (str, optional): Database driver to be used.

    Returns:
        str: Formatted schema generated.
    """
    parts = [dialect]
    if driver is not None and driver != '':
        parts += [driver]
    return '+'.join(parts)