def run_line_magic(self, magic_name: str, line, _stack_depth=1):
    "Execute the given line magic.\n\n        Parameters\n        ----------\n        magic_name : str\n            Name of the desired magic function, without '%' prefix.\n        line : str\n            The rest of the input line as a single string.\n        _stack_depth : int\n            If run_line_magic() is called from magic() then _stack_depth=2.\n            This is added to ensure backward compatibility for use of 'get_ipython().magic()'\n        "
    fn = self._find_with_lazy_load('line', magic_name)
    if (fn is None):
        lazy = self.magics_manager.lazy_magics.get(magic_name)
        if lazy:
            self.run_line_magic('load_ext', lazy)
            fn = self.find_line_magic(magic_name)
    if (fn is None):
        cm = self.find_cell_magic(magic_name)
        etpl = 'Line magic function `%%%s` not found%s.'
        extra = ('' if (cm is None) else (' (But cell magic `%%%%%s` exists, did you mean that instead?)' % magic_name))
        raise UsageError((etpl % (magic_name, extra)))
    else:
        stack_depth = _stack_depth
        if getattr(fn, magic.MAGIC_NO_VAR_EXPAND_ATTR, False):
            magic_arg_s = line
        else:
            magic_arg_s = self.var_expand(line, stack_depth)
        args = [magic_arg_s]
        kwargs = {}
        if getattr(fn, 'needs_local_scope', False):
            kwargs['local_ns'] = self.get_local_scope(stack_depth)
        with self.builtin_trap:
            result = fn(*args, **kwargs)
        return result
Execute the given line magic.

Parameters
----------
magic_name : str
    Name of the desired magic function, without '%' prefix.
line : str
    The rest of the input line as a single string.
_stack_depth : int
    If run_line_magic() is called from magic() then _stack_depth=2.
    This is added to ensure backward compatibility for use of 'get_ipython().magic()'
def run_line_magic(self, magic_name: str, line, _stack_depth=1):
    "Execute the given line magic.\n\n        Parameters\n        ----------\n        magic_name : str\n            Name of the desired magic function, without '%' prefix.\n        line : str\n            The rest of the input line as a single string.\n        _stack_depth : int\n            If run_line_magic() is called from magic() then _stack_depth=2.\n            This is added to ensure backward compatibility for use of 'get_ipython().magic()'\n        "
    fn = self._find_with_lazy_load('line', magic_name)
    if (fn is None):
        lazy = self.magics_manager.lazy_magics.get(magic_name)
        if lazy:
            self.run_line_magic('load_ext', lazy)
            fn = self.find_line_magic(magic_name)
    if (fn is None):
        cm = self.find_cell_magic(magic_name)
        etpl = 'Line magic function `%%%s` not found%s.'
        extra = ( if (cm is None) else (' (But cell magic `%%%%%s` exists, did you mean that instead?)' % magic_name))
        raise UsageError((etpl % (magic_name, extra)))
    else:
        stack_depth = _stack_depth
        if getattr(fn, magic.MAGIC_NO_VAR_EXPAND_ATTR, False):
            magic_arg_s = line
        else:
            magic_arg_s = self.var_expand(line, stack_depth)
        args = [magic_arg_s]
        kwargs = {}
        if getattr(fn, 'needs_local_scope', False):
            kwargs['local_ns'] = self.get_local_scope(stack_depth)
        with self.builtin_trap:
            result = fn(*args, **kwargs)
        return result