def loads(text):
    """
    Parses TOML text into a dict-like object and returns it.
    """
    from prettytoml.parser import parse_tokens
    from prettytoml.lexer import tokenize as lexer
    from .file import TOMLFile

    tokens = tuple(lexer(text, is_top_level=True))
    elements = parse_tokens(tokens)
    return TOMLFile(elements)