<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _build_relations_config(self, yamlconfig):
 """Builds a dictionary from relations configuration while maintaining compatibility """

        config = {}
        for element in yamlconfig:
            if isinstance(element, str):
                config[element] = {'relation_name': element, 'schemas': []}
            elif isinstance(element, dict):
                if 'relation_name' not in element or 'schemas' not in element:
                    self.log.warning("Unknown element format for relation element %s", element)
                    continue
                if not isinstance(element['schemas'], list):
                    self.log.warning("Expected a list of schemas for %s", element)
                    continue
                name = element['relation_name']
                config[name] = {'relation_name': name, 'schemas': element['schemas']}
            else:
                self.log.warning('Unhandled relations config type: {}'.format(element))
        return config