def drop_unspecified_subcategories(db):
    """Drop subcategories if they are in the following:
        * ``unspecified``
        * ``(unspecified)``
        * ``''`` (empty string)
        * ``None``

    """
    UNSPECIFIED = {'unspecified', '(unspecified)', '', None}
    for ds in db:
        if ds.get('categories'):
            while ds['categories'] and ds['categories'][-1] in UNSPECIFIED:
                ds['categories'] = ds['categories'][:-1]
        for exc in ds.get('exchanges', []):
            if exc.get('categories'):
                while (exc['categories'] and
                       exc['categories'][-1] in UNSPECIFIED):
                    exc['categories'] = exc['categories'][:-1]
    return db