def __str__(self):
nvariants = len(self)<EOL>nversions = len(self.entries)<EOL>if nvariants == <NUM_LIT:1>:<EOL><INDENT>variant = self.first_variant<EOL>s_idx = "<STR_LIT>" if variant.index is None else "<STR_LIT>" % variant.index<EOL>s = "<STR_LIT>" % (self.package_name, str(variant.version), s_idx)<EOL><DEDENT>elif nversions == <NUM_LIT:1>:<EOL><INDENT>entry = self.entries[<NUM_LIT:0>]<EOL>indexes = sorted([x.index for x in entry.variants])<EOL>s_idx = '<STR_LIT:U+002C>'.join(str(x) for x in indexes)<EOL>verstr = str(entry.version)<EOL>s = "<STR_LIT>" % (self.package_name, verstr, s_idx)<EOL><DEDENT>else:<EOL><INDENT>verstr = "<STR_LIT>" % nvariants if (nversions == nvariants)else "<STR_LIT>" % (nversions, nvariants)<EOL>span = self.range_.span()<EOL>s = "<STR_LIT>" % (self.package_name, str(span), verstr)<EOL><DEDENT>strextr = '<STR_LIT:*>' if self.extractable else '<STR_LIT>'<EOL>return s + strextr<EOL>
foo[2..6(3:4)]* means, 3 versions, 4 variants in 2..6, and at least one
    family can still be extracted.
foo[2..6(2)] means, 2 versions in 2..6.
[foo==2[1,2]] means, 1st and 2nd variants of exact version foo-2.
[foo==2]* means, exact version foo-2, families still to extract.
[foo==2] means a resolved package (no variants in the package).
[foo=2[0]] means a resolved package (zeroeth variant).