def extract_status_code_from_topic(topic):
    """
    Topics for responses from DPS are of the following format:
    $dps/registrations/res/<statuscode>/?$<key1>=<value1>&<key2>=<value2>&<key3>=<value3>
    Extract the status code part from the topic.
    :param topic: The topic string
    """
    POS_STATUS_CODE_IN_TOPIC = 3
    topic_parts = topic.split("$")
    url_parts = topic_parts[1].split("/")
    status_code = url_parts[POS_STATUS_CODE_IN_TOPIC]
    return status_code