Find the usage of a permission inside the Analysis.

        example::
            from androguard.misc import AnalyzeAPK
            a, d, dx = AnalyzeAPK("somefile.apk")

            for meth in dx.get_permission_usage('android.permission.SEND_SMS', a.get_effective_target_sdk_version()):
                print("Using API method {}".format(meth))
                print("used in:")
                for _, m, _ in meth.get_xref_from():
                    print(m.full_name)

        .. note::
            The permission mappings might be incomplete! See also :meth:`get_permissions`.

        :param permission: the name of the android permission (usually 'android.permission.XXX')
        :param apilevel: the requested API level or None for default
        :return: yields :class:`MethodClassAnalysis` objects for all using API methods

def get_permission_usage(self, permission, apilevel=None):
        """
        Find the usage of a permission inside the Analysis.

        example::
            from androguard.misc import AnalyzeAPK
            a, d, dx = AnalyzeAPK("somefile.apk")

            for meth in dx.get_permission_usage('android.permission.SEND_SMS', a.get_effective_target_sdk_version()):
                print("Using API method {}".format(meth))
                print("used in:")
                for _, m, _ in meth.get_xref_from():
                    print(m.full_name)

        .. note::
            The permission mappings might be incomplete! See also :meth:`get_permissions`.

        :param permission: the name of the android permission (usually 'android.permission.XXX')
        :param apilevel: the requested API level or None for default
        :return: yields :class:`MethodClassAnalysis` objects for all using API methods
        """

        # TODO maybe have the API level loading in the __init__ method and pass the APK as well?
        permmap = load_api_specific_resource_module('api_permission_mappings', apilevel)
        if not permmap:
            raise ValueError("No permission mapping found! Is one available? "
                             "The requested API level was '{}'".format(apilevel))

        apis = {k for k, v in permmap.items() if permission in v}
        if not apis:
            raise ValueError("No API methods could be found which use the permission. "
                             "Does the permission exists? You requested: '{}'".format(permission))

        for cls in self.get_external_classes():
            for meth_analysis in cls.get_methods():
                meth = meth_analysis.get_method()
                if meth.permission_api_name in apis:
                    yield meth_analysis