Decorator to specify that a target connection is required in order
        for the given method to be used.

        Args:
          func (function): function being decorated

        Returns:
          The wrapper function.

def connection_required(func):
        """Decorator to specify that a target connection is required in order
        for the given method to be used.

        Args:
          func (function): function being decorated

        Returns:
          The wrapper function.
        """
        @functools.wraps(func)
        def wrapper(self, *args, **kwargs):
            """Wrapper function to check that the given ``JLink`` has been
            connected to a target.

            Args:
              self (JLink): the ``JLink`` instance
              args: list of arguments to pass to the wrapped function
              kwargs: key-word arguments dict to pass to the wrapped function

            Returns:
              The return value of the wrapped function.

            Raises:
              JLinkException: if the JLink's target is not connected.
            """
            if not self.target_connected():
                raise errors.JLinkException('Target is not connected.')
            return func(self, *args, **kwargs)
        return wrapper