def GetMessageFromQueue(session, queueurl, delete_after_receive=False):
  """Get message from the queue to process

  :param session: Session to use for AWS access
  :type session: boto3.session.Session
  :param queueurl: URL of the queue from which to receive messages
  :type queueurl: str
  :param delete_after_receive: If True, the message will be deleted immediately after receipt
  :type delete_after_receive: bool
  :return: A tuple consisting of (The message body, The message receipt handle)
  :rtype: tuple
  """
  sqsconn = session.connect_to("sqs")
  Messages = session.get_collection("sqs", "MessageCollection")
  messages = Messages(connection=sqsconn, queue_url=queueurl)
  # Try to get 1 message at a time by waiting at most 20 seconds
  for m in messages.each(wait_time_seconds=20, max_number_of_messages=1):
    if delete_after_receive:
      m.delete(queue_url=queueurl, receipt_handle=m.receipt_handle)
    return m.body, m.receipt_handle
  return None, None