def date_from_adverb(base_date, name):
 adverb_date = datetime(base_date.year, base_date.month, base_date.day)
 if ((name == 'today') or (name == 'tonite') or (name == 'tonight')):
  return adverb_date.today()
 elif (name == 'yesterday'):
  return (adverb_date - timedelta(days=1))
 elif ((name == 'tomorrow') or (name == 'tom')):
  return (adverb_date + timedelta(days=1))

def date_from_adverb ( base_date , name ) : adverb_date = datetime ( base_date . year , base_date . month , base_date . day ) if ( ( name == 'today' ) or ( name == 'tonite' ) or ( name == 'tonight' ) ) : return adverb_date . today ( ) elif ( name == 'yesterday' ) : return ( adverb_date - timedelta ( days = 1 ) ) elif ( ( name == 'tomorrow' ) or ( name == 'tom' ) ) : return ( adverb_date + timedelta ( days = 1 ) )
convert day adverbs to dates tomorrow => date today => date .