code: def find_similar_days(training_data, now, observation_length, k, method=hamming_distance):
  	min_time = training_data.index[0] + timedelta(minutes=observation_length)
  	# Find moments in our dataset that have the same hour/minute and is_weekend() == weekend.
  
  	selector = ((training_data.index.minute == now.minute) &
  				(training_data.index.hour == now.hour) &
  				(training_data.index > min_time))
  
  	
  
  	similar_moments = training_data[selector][:-1]
  
  	obs_td = timedelta(minutes=observation_length)
  
  	similar_moments['Similarity'] = [
  		method(
  			training_data[(training_data.index >= now - obs_td) &
  							(training_data.index <= now)].get_values(),
  			training_data[(training_data.index >= i - obs_td) &
  							(training_data.index <= i)].get_values()
  		) for i in similar_moments.index
  		]
  
  	indexes = (similar_moments.sort_values('Similarity', ascending=True)
  				.head(k).index)
  	return indexes
docs: if now.weekday() < 5:
  		selector = (
  			(training_data.index.minute == now.minute) &
  			(training_data.index.hour == now.hour) &
  			(training_data.index > min_time) &
  			(training_data.index.weekday < 5)
  		)
  	else:
  		selector = (
  			(training_data.index.minute == now.minute) &
  			(training_data.index.hour == now.hour) &
  			(training_data.index > min_time) &
  			(training_data.index.weekday >= 5)
  		)