def _get_application(self, app_name):
        params = None
        if app_name:
            params = {'filter[name]': app_name}
        url = urllib_parse.urljoin(self._api_url, 'applications.json')
        resp = requests.get(url, headers=self._headers, params=params).json()
        if 'applications' in resp:
            # pick 1st application
            return resp['applications'][0] if resp['applications'] else None
        return None
dataset/ETHPy150Open StackStorm/st2contrib/packs/newrelic/sensors/new_relic_legacy_app_sensor.py/LegacyNewRelicHookSensor._get_application/original