Causes a function to loop indefinitely.

def loop(_=None, force=False):   # pylint: disable=invalid-name
  """Causes a function to loop indefinitely."""
  if not force:
    raise AttributeError(
        'threads.loop() is DEPRECATED.  If you really like this and want to '
        'keep it, file an issue at https://github.com/google/openhtf/issues '
        'and use it as @loop(force=True) for now.')

  def real_loop(fn):
    @functools.wraps(fn)
    def _proc(*args, **kwargs):
      """Wrapper to return."""
      while True:
        fn(*args, **kwargs)
    _proc.once = fn  # way for tests to invoke the function once
                     # you may need to pass in "self" since this may be unbound.
    return _proc
  return real_loop