def main(options, arguments):
    if options.input != None:
        buff = ""

        arscobj = None
        ret_type = androconf.is_android(options.input)
        if ret_type == "APK":
            a = apk.APK(options.input)
            arscobj = a.get_android_resources()
        elif ret_type == "ARSC":
            arscobj = apk.ARSCParser(read(options.input))
        else:
            print "Unknown file type"
            return

        if not options.package and not options.type and not options.locale:
            buff = ""
            for package in arscobj.get_packages_names():
                buff += package + "\n"
                for locale in arscobj.get_locales(package):
                    buff += "\t" + repr(locale) + "\n"
                    for ttype in arscobj.get_types(package, locale):
                        buff += "\t\t" + ttype + "\n"

        else:
            package = options.package or arscobj.get_packages_names()[0]
            ttype = options.type or "public"
            locale = options.locale or '\x00\x00'

            buff = minidom.parseString(getattr(
                arscobj, "get_" + ttype + "_resources")(package,
                                                        locale)).toprettyxml()

        if options.output != None:
            fd = codecs.open(options.output, "w", "utf-8")
            fd.write(buff)
            fd.close()
        else:
            print buff

    elif options.version != None:
        print "Androarsc version %s" % androconf.ANDROGUARD_VERSION
dataset/ETHPy150Open androguard/androguard/androarsc.py/main/original