code: def callstop(*args, **kwargs):
      
      limit = kwargs.get('limit', 1)
      def decor(func):
          def wrapper(*args, **kwargs):
              if wrapper.calls < limit:
                  wrapper.calls += 1
                  return func(*args, **kwargs)
          wrapper.calls = 0
          return wrapper
      if len(args) > 0 and callable(args[0]):
          func = args[0]
          return decor(func)
      return decor
docs: Limits the number of times a function can be called. Can be used as a
      function decorator or as a function that accepts another function. If used
      as a function, it returns a new function that will be call limited.
  
      **Params**:
        - func (func) - Function to call. Only available when used as a function.
  
      **Examples**:
      ::
  
          call = callstop(myfunc, limit=3)
          call(myarg1, myarg2)