def _find_display():
 display = 1
 while os.path.exists('/tmp/.X{0}-lock'.format(display)):
  display += 1
 return display

def _find_display ( ) : display = 1 while os . path . exists ( '/tmp/.X{0}-lock' . format ( display ) ) : display += 1 return display
returns the next available display .