def valid_timestamp(request):
 try:
  return request.timestamp
 except exceptions.InvalidTimestamp as e:
  raise HTTPBadRequest(body=str(e), request=request, content_type='text/plain')

def valid_timestamp ( request ) : try : return request . timestamp except exceptions . InvalidTimestamp as e : raise HTTPBadRequest ( body = str ( e ) , request = request , content_type = 'text/plain' )
helper function to extract a timestamp from requests that require one .