Get serialized reference datas

        Because every reference is turned to a dict (that stands on ``keys``
        variable that is a list of key names), every variables must have the
        same exact length of word than the key name list.

        A reference name starts with 'styleguide-reference-' followed by
        name for reference.

        A reference can contains variable ``--structure`` setted to ``"flat"``,
        ``"list"`` or ``"string"`` to define serialization structure.

        Arguments:
            datas (dict): Data where to search for reference declaration. This
                is commonly the fully parsed manifest.
            name (string): Reference name to get and serialize.

        Returns:
            collections.OrderedDict: Serialized reference datas.

def get_reference(self, datas, name):
        """
        Get serialized reference datas

        Because every reference is turned to a dict (that stands on ``keys``
        variable that is a list of key names), every variables must have the
        same exact length of word than the key name list.

        A reference name starts with 'styleguide-reference-' followed by
        name for reference.

        A reference can contains variable ``--structure`` setted to ``"flat"``,
        ``"list"`` or ``"string"`` to define serialization structure.

        Arguments:
            datas (dict): Data where to search for reference declaration. This
                is commonly the fully parsed manifest.
            name (string): Reference name to get and serialize.

        Returns:
            collections.OrderedDict: Serialized reference datas.
        """
        rule_name = '-'.join((RULE_REFERENCE, name))
        structure_mode = 'nested'

        if rule_name not in datas:
            msg = "Unable to find enabled reference '{}'"
            raise SerializerError(msg.format(name))

        properties = datas.get(rule_name)

        # Search for "structure" variable
        if 'structure' in properties:
            if properties['structure'] == 'flat':
                structure_mode = 'flat'
            elif properties['structure'] == 'list':
                structure_mode = 'list'
            elif properties['structure'] == 'string':
                structure_mode = 'string'
            elif properties['structure'] == 'json':
                structure_mode = 'json'
            elif properties['structure'] == 'nested':
                pass
            else:
                msg = "Invalid structure mode name '{}' for reference '{}'"
                raise SerializerError(msg.format(structure_mode, name))
            del properties['structure']

        # Validate variable names
        for item in properties.keys():
            self.validate_variable_name(item)

        # Perform serialize according to structure mode
        if structure_mode == 'flat':
            context = self.serialize_to_flat(name, properties)
        elif structure_mode == 'list':
            context = self.serialize_to_list(name, properties)
        elif structure_mode == 'string':
            context = self.serialize_to_string(name, properties)
        elif structure_mode == 'nested':
            context = self.serialize_to_nested(name, properties)
        elif structure_mode == 'json':
            context = self.serialize_to_json(name, properties)

        return context