def set_code_by_activity_hash(db, overwrite=False):
    "Use ``activity_hash`` to set dataset code.\n\n    By default, won't overwrite existing codes, but will if ``overwrite`` is ``True``."
    for ds in db:
        if (('code' not in ds) or overwrite):
            ds['code'] = activity_hash(ds)
    return db
Use ``activity_hash`` to set dataset code.

By default, won't overwrite existing codes, but will if ``overwrite`` is ``True``.
def set_code_by_activity_hash(db, overwrite=False):
    "Use ``activity_hash`` to set dataset code.\n\n    By default, won't overwrite existing codes, but will if ``overwrite`` is ``True``."
    for ds in db:
        if (('code' not in ds) or overwrite):
            ds['code'] = activity_hash(ds)
    return db