<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_valid_reff(self, urn, level):
 """ Provisional route for GetValidReff request :param urn: URN to filter the resource :return: GetValidReff response """

        urn = URN(urn)
        subreference = None
        textId=urn.upTo(URN.NO_PASSAGE)
        if urn.reference is not None:
            subreference = str(urn.reference)
        reffs = self.resolver.getReffs(textId=textId, subreference=subreference, level=level)
        r = render_template(
            "cts/GetValidReff.xml",
            reffs=reffs,
            urn=textId,
            level=level,
            request_urn=str(urn)
        )
        return r, 200, {"content-type": "application/xml"}