def has_links(html):
 class LinkFound(Exception, ):
  pass
 def raise_on_link(attrs, new):
  raise LinkFound
 try:
  bleach.linkify(html, callbacks=[raise_on_link])
 except LinkFound:
  return True
 return False

def has_links ( html ) : class LinkFound ( Exception , ) : pass def raise_on_link ( attrs , new ) : raise LinkFound try : bleach . linkify ( html , callbacks = [ raise_on_link ] ) except LinkFound : return True return False
return true if links are found in the given html .