def get_variants(self, arch=None, types=None, recursive=False):
types = types or []<EOL>result = []<EOL>if "<STR_LIT>" in types:<EOL><INDENT>result.append(self)<EOL><DEDENT>for variant in six.itervalues(self.variants):<EOL><INDENT>if types and variant.type not in types:<EOL><INDENT>continue<EOL><DEDENT>if arch and arch not in variant.arches.union(["<STR_LIT:src>"]):<EOL><INDENT>continue<EOL><DEDENT>result.append(variant)<EOL>if recursive:<EOL><INDENT>result.extend(variant.get_variants(types=[i for i in types if i != "<STR_LIT>"], recursive=True))<EOL><DEDENT><DEDENT>result.sort(key=lambda x: x.uid)<EOL>return result<EOL>
Return all variants of given arch and types.

Supported variant types:
    self     - include the top-level ("self") variant as well
    addon
    variant
    optional