@library.global_function
def random_funfact():
 if FunFact.objects.published().count():
  return FunFact.objects.random()
 return None

@ library . global_function def random_funfact ( ) : if FunFact . objects . published ( ) . count ( ) : return FunFact . objects . random ( ) return None
returns random funfact or none .