code: def swipe(self, p1, p2=None, direction=None, duration=2.0):
          
  
          try:
              duration = float(duration)
          except ValueError:
              raise ValueError('Argument `duration` should be <float>. Got {}'.format(repr(duration)))
  
          if not (0 <= p1[0] <= 1) or not (0 <= p1[1] <= 1):
              raise InvalidOperationException('Swipe origin out of screen. {}'.format(repr(p1)))
          if direction is not None:
              p2 = [p1[0] + direction[0], p1[1] + direction[1]]
          elif p2 is not None:
              p2 = p2
          else:
              raise TypeError('Swipe end not set.')
          return self.agent.input.swipe(p1[0], p1[1], p2[0], p2[1], duration)
docs: Perform swipe action on target device from point to point given by start point and end point, or by the
          direction vector. At least one of the end point or direction must be provided.
  
          The coordinates (x, y) definition for points is the same as for ``click`` event. The components of the
          direction vector (x, y) are also expressed in the range of the screen from 0 to 1.
  
          See ``CoordinateSystem`` for more details about coordinate system.
  
          Examples:
              Following example shows how to perform a swipe action from (100, 100) to (100, 200) on screen with
              resolution 1920x1080::
  
                  poco.swipe([100.0 / 1920, 100.0 / 1080], [100.0 / 1920, 200.0 / 1080])
  
              Or given by the specific direction instead of end point::
  
                  poco.swipe([100.0 / 1920, 100.0 / 1080], direction=[0, 100.0 / 1080])
  
          Args:
              p1 (:obj:`2-list/2-tuple`): start point
              p2: end point
              direction: swipe direction
              duration (:obj:`float`): time interval in which the swipe action is performed
  
          Raises:
              InvalidOperationException: when the start point of the swipe action lies outside the screen