def previous_friday(dt):
 if (dt.weekday() == 5):
  return (dt - timedelta(1))
 elif (dt.weekday() == 6):
  return (dt - timedelta(2))
 return dt

def previous_friday ( dt ) : if ( dt . weekday ( ) == 5 ) : return ( dt - timedelta ( 1 ) ) elif ( dt . weekday ( ) == 6 ) : return ( dt - timedelta ( 2 ) ) return dt
if holiday falls on saturday or sunday .