def get_completions(prefix, paths=None, family_only=False):
op = None<EOL>if prefix:<EOL><INDENT>if prefix[<NUM_LIT:0>] in ('<STR_LIT:!>', '<STR_LIT>'):<EOL><INDENT>if family_only:<EOL><INDENT>return set()<EOL><DEDENT>op = prefix[<NUM_LIT:0>]<EOL>prefix = prefix[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>fam = None<EOL>for ch in ('<STR_LIT:->', '<STR_LIT:@>', '<STR_LIT:#>'):<EOL><INDENT>if ch in prefix:<EOL><INDENT>if family_only:<EOL><INDENT>return set()<EOL><DEDENT>fam = prefix.split(ch)[<NUM_LIT:0>]<EOL>break<EOL><DEDENT><DEDENT>words = set()<EOL>if not fam:<EOL><INDENT>words = set(x.name for x in iter_package_families(paths=paths)<EOL>if x.name.startswith(prefix))<EOL>if len(words) == <NUM_LIT:1>:<EOL><INDENT>fam = iter(words).next()<EOL><DEDENT><DEDENT>if family_only:<EOL><INDENT>return words<EOL><DEDENT>if fam:<EOL><INDENT>it = iter_packages(fam, paths=paths)<EOL>words.update(x.qualified_name for x in it<EOL>if x.qualified_name.startswith(prefix))<EOL><DEDENT>if op:<EOL><INDENT>words = set(op + x for x in words)<EOL><DEDENT>return words<EOL>
Get autocompletion options given a prefix string.

    Example:

        >>> get_completions("may")
        set(["maya", "maya_utils"])
        >>> get_completions("maya-")
        set(["maya-2013.1", "maya-2015.0.sp1"])

    Args:
        prefix (str): Prefix to match.
        paths (list of str): paths to search for packages, defaults to
            `config.packages_path`.
        family_only (bool): If True, only match package names, do not include
            version component.

    Returns:
        Set of strings, may be empty.