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.

def check_structure(data):
    """
    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.
    """
    if not isinstance(data, dict):
        try:
            data = _convert_to_dict(data)
        except MetaParsingException:
            raise
        except:
            raise MetaParsingException(
                "Metadata format has invalid strucure (dict is expected)."
            )

    for key, val in data.iteritems():
        if type(key) not in _ALLOWED_TYPES:
            raise MetaParsingException(
                "Can't decode the meta file - invalid type of keyword '" +
                str(key) +
                "'!"
            )
        if type(val) not in _ALLOWED_TYPES:
            raise MetaParsingException(
                "Can't decode the meta file - invalid type of keyword '" +
                str(key) +
                "'!"
            )

    return data