def img_check(elem):
 img = elem.xpath('img')
 if img:
  return 'Y'
 else:
  text = elem.text_content().strip()
  if text:
   return 'Y'
  else:
   return 'N'

def img_check ( elem ) : img = elem . xpath ( 'img' ) if img : return 'Y' else : text = elem . text_content ( ) . strip ( ) if text : return 'Y' else : return 'N'
checks if the cell contains an image and returns true or false used to see if a calendar was modified revised or cancelled .