@staticmethod<EOL><INDENT>def _get_debug_context(debug_port, debug_args, debugger_path):<DEDENT>
if debug_port and debugger_path:<EOL><INDENT>try:<EOL><INDENT>debugger = Path(debugger_path).resolve(strict=True)<EOL><DEDENT>except OSError as error:<EOL><INDENT>if error.errno == errno.ENOENT:<EOL><INDENT>raise DebugContextException("<STR_LIT>".format(debugger_path))<EOL><DEDENT>else:<EOL><INDENT>raise error<EOL><DEDENT><DEDENT>if not debugger.is_dir():  <EOL><INDENT>raise DebugContextException("<STR_LIT>".format(debugger_path))<EOL><DEDENT>debugger_path = str(debugger)<EOL><DEDENT>return DebugContext(debug_port=debug_port, debug_args=debug_args, debugger_path=debugger_path)<EOL>
Creates a DebugContext if the InvokeContext is in a debugging mode

Parameters
----------
debug_port int
     Port to bind the debugger to
debug_args str
    Additional arguments passed to the debugger
debugger_path str
    Path to the directory of the debugger to mount on Docker

Returns
-------
samcli.commands.local.lib.debug_context.DebugContext
    Object representing the DebugContext

Raises
------
samcli.commands.local.cli_common.user_exceptions.DebugContext
    When the debugger_path is not valid