# scan is either a scan_no or a database v1 header in this example.
def recover_function(scan=-1):
if isinstance(scan, int):
# It'd be probably better to use V2 for this...
scan = db.v1[scan_no]
undulatory.downstream.offset.put(scan.config_data('undulator')['baseline'][0]['undulator_downstream_offset'])
...
Something like: