Receives something like:

           {
             "$ref": "#/files/description/1"
           },

        Or:

           {
             "$ref": "#/files/fix/39"
           }

        And returns the contents of the description or fix file.

        :param attr: A dict containing a reference
        :param language: The user's language (en, es, etc.)
        :return: Markdown referenced by the attr

def handle_ref(attr, language=DEFAULT_LANG):
        """
        Receives something like:

           {
             "$ref": "#/files/description/1"
           },

        Or:

           {
             "$ref": "#/files/fix/39"
           }

        And returns the contents of the description or fix file.

        :param attr: A dict containing a reference
        :param language: The user's language (en, es, etc.)
        :return: Markdown referenced by the attr
        """
        ref = attr.get('$ref', None)
        if ref is None:
            raise NotFoundException('No $ref in attribute')

        _, files, _type, _id = ref.split('/')

        if 'files' != files:
            raise NotFoundException('Mandatory "files" path was not found in $ref')

        if _type not in ('fix', 'description'):
            raise NotFoundException('Mandatory fix or description not found in $ref')

        if not _id.isdigit():
            raise NotFoundException('Mandatory integer ID not found in $ref')

        file_path = os.path.join(DBVuln.get_json_path(language=language),
                                 _type,
                                 '%s.md' % _id)

        if not os.path.exists(file_path):
            raise NotFoundException('$ref points to a non existing file')

        return file(file_path).read()