def find_preprint_provider(node):
 try:
  preprint = PreprintService.find_one(Q('node', 'eq', node._id))
  provider = preprint.provider
  if (provider._id == 'osf'):
   return ('osf', provider.name)
  else:
   return ('branded', provider.name)
 except Exception:
  return (None, None)

def find_preprint_provider ( node ) : try : preprint = PreprintService . find_one ( Q ( 'node' , 'eq' , node . _id ) ) provider = preprint . provider if ( provider . _id == 'osf' ) : return ( 'osf' , provider . name ) else : return ( 'branded' , provider . name ) except Exception : return ( None , None )
given a node .