def METHOD_NAME(line, cursor, namespace, private):
    """Returns a list of possible completions:
    * name completion
    * attribute completion (obj.attr)
    * index completion for lists and dictionaries
    * module completion (from/import)
    :arg line: incomplete text line
    :type line: str
    :arg cursor: current character position
    :type cursor: int
    :arg namespace: namespace
    :type namespace: dict
    :arg private: whether private variables should be listed
    :type private: bool
    :returns: list of completions, word
    :rtype: list, str
    >>> complete('re.sr', 5, {'re': re})
    (['re.sre_compile', 're.sre_parse'], 're.sr')
    """
    re_unquoted_word = RE_UNQUOTED_WORD.search(line[:cursor])
    if re_unquoted_word:
        # unquoted word -> module or attribute completion
        word = re_unquoted_word.group(1)
        if RE_MODULE.match(line):
            from . import complete_import
            matches = complete_import.METHOD_NAME(line)
            if not private:
                matches[:] = [m for m in matches if m[:1] != "_"]
            matches.sort()
        else:
            from . import complete_namespace
            matches = complete_namespace.METHOD_NAME(word, namespace, private=private)
    else:
        # for now we don't have completers for strings
        # TODO: add file auto completer for strings
        word = ''
        matches = []
    return matches, word