def get_export_filename(region, subregion, layerset, pgosm_date):
    """Returns the .sql filename to use from pg_dump.

    Parameters
    ----------------------
    region : str
    subregion : str
    layerset : str
    pgosm_date : str

    Returns
    ----------------------
    filename : str
    """
    region = region.replace('/', '-')
    subregion = subregion.replace('/', '-')
    if subregion is None:
        filename = f'pgosm-flex-{region}-{layerset}-{pgosm_date}.sql'
    else:
        filename = f'pgosm-flex-{region}-{subregion}-{layerset}-{pgosm_date}.sql'

    return filename