finish_time = datetime.datetime.now() + datetime.timedelta(hours=6)
while datetime.datetime.now() < finish_time:
    do_something()
sleep_for_a_bit()
How can I repeat something for x minutes in Python?