+from boto3.dynamodb.conditions import Key
+
+def find_puzzle_for_url(turb, hunt_id, url):
+ """Given a hunt_id and URL, return the puzzle with that URL
+
+ Returns None if no puzzle with the given URL exists in the database,
+ otherwise a dictionary with all fields from the puzzle's row in
+ the database.
+ """
+
+ response = turb.table.query(
+ IndexName='url_index',
+ KeyConditionExpression=(
+ Key('hunt_id').eq(hunt_id) &
+ Key('url').eq(url)
+ )
+ )
+
+ if response['Count'] == 0:
+ return None
+
+ return response['Items'][0]