code: def unregister(callback, event=None):
      
      found = 0
      if event and not isinstance(event, type):
          event = type(event)
  
      handlers = getattr(callback, _HANDLERS_ATTRIBUTE, [])
      handlers.append((event, callback))
      i = len(handlers)
      while i:
          i -= 1
          ev = handlers[i]
          if not event or isinstance(ev, event):
              del handlers[i]
              found += 1
  
      return found
docs: Inverse operation of `register` (though not a decorator). Client-less
      `remove_event_handler
      <telethon.client.updates.UpdateMethods.remove_event_handler>`
      variant. **Note that this won't remove handlers from the client**,
      because it simply can't, so you would generally use this before
      adding the handlers to the client.
  
      This method is here for symmetry. You will rarely need to
      unregister events, since you can simply just not add them
      to any client.
  
      If no event is given, all events for this callback are removed.
      Returns how many callbacks were removed.