move write lib function to new notebook

should fix import issues with library code