def check_structure(data):
if not isinstance(data, dict):<EOL><INDENT>try:<EOL><INDENT>data = _convert_to_dict(data)<EOL><DEDENT>except MetaParsingException:<EOL><INDENT>raise<EOL><DEDENT>except:<EOL><INDENT>raise MetaParsingException(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT>for key, val in data.iteritems():<EOL><INDENT>if type(key) not in _ALLOWED_TYPES:<EOL><INDENT>raise MetaParsingException(<EOL>"<STR_LIT>" +<EOL>str(key) +<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if type(val) not in _ALLOWED_TYPES:<EOL><INDENT>raise MetaParsingException(<EOL>"<STR_LIT>" +<EOL>str(key) +<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT>return data<EOL>
Check whether the structure is flat dictionary. If not, try to convert it
to dictionary.

Args:
    data: Whatever data you have (dict/tuple/list).

Returns:
    dict: When the conversion was successful or `data` was already `good`.

Raises:
    MetaParsingException: When the data couldn't be converted or had `bad`
                          structure.