nodes: 0, module; 1, function_definition; 2, function_name:remove; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, identifier:index; 15, None; 16, identifier:hash; 17, None; 18, identifier:keepSorted; 19, True; 20, comment:""" 
          Removes a particle from the simulation.
  
          Parameters
          ----------
          index : int, optional
              Specify particle to remove by index.
          hash : c_uint32 or string, optional
              Specifiy particle to remove by hash (if a string is passed, the corresponding hash is calculated).
          keepSorted : bool, optional
              By default, remove preserves the order of particles in the particles array. 
              Might set it to zero in cases with many particles and many removals to speed things up.
          """; 21, comparison_operator:index is not None; 22, block; 23, comparison_operator:hash is not None; 24, block; 25, call; 26, block; 27, call; 28, identifier:index; 29, None; 30, expression_statement; 31, identifier:hash; 32, None; 33, expression_statement; 34, expression_statement; 35, if_statement; 36, if_statement; 37, identifier:hasattr; 38, argument_list; 39, expression_statement; 40, attribute; 41, argument_list; 42, call; 43, assignment; 44, assignment; 45, identifier:PY3; 46, block; 47, else_clause; 48, call; 49, block; 50, elif_clause; 51, elif_clause; 52, identifier:self; 53, string; 54, call; 55, identifier:self; 56, identifier:process_messages; 57, attribute; 58, argument_list; 59, identifier:hash_types; 60, expression_list; 61, identifier:PY3; 62, comparison_operator:sys.version_info[0] == 3; 63, expression_statement; 64, expression_statement; 65, block; 66, identifier:isinstance; 67, argument_list; 68, expression_statement; 69, call; 70, block; 71, call; 72, block; 73, string_content:_widgets; 74, attribute; 75, argument_list; 76, identifier:clibrebound; 77, identifier:reb_remove; 78, call; 79, identifier:index; 80, identifier:keepSorted; 81, identifier:c_uint32; 82, identifier:c_uint; 83, identifier:c_ulong; 84, subscript; 85, integer:3; 86, assignment; 87, assignment; 88, expression_statement; 89, expression_statement; 90, identifier:hash; 91, identifier:string_types; 92, call; 93, identifier:isinstance; 94, argument_list; 95, expression_statement; 96, identifier:isinstance; 97, argument_list; 98, expression_statement; 99, identifier:self; 100, identifier:_display_heartbeat; 101, call; 102, identifier:byref; 103, argument_list; 104, attribute; 105, integer:0; 106, identifier:string_types; 107, expression_list; 108, identifier:int_types; 109, expression_list; 110, assignment; 111, assignment; 112, attribute; 113, argument_list; 114, identifier:hash; 115, identifier:int_types; 116, call; 117, identifier:hash; 118, identifier:hash_types; 119, call; 120, identifier:pointer; 121, argument_list; 122, identifier:self; 123, identifier:sys; 124, identifier:version_info; 125, identifier:str; 126, identifier:int; 127, identifier:string_types; 128, expression_list; 129, identifier:int_types; 130, expression_list; 131, identifier:clibrebound; 132, identifier:reb_remove_by_hash; 133, call; 134, call; 135, identifier:keepSorted; 136, attribute; 137, argument_list; 138, attribute; 139, argument_list; 140, identifier:self; 141, identifier:basestring; 142, identifier:int; 143, identifier:long; 144, identifier:byref; 145, argument_list; 146, identifier:rebhash; 147, argument_list; 148, identifier:clibrebound; 149, identifier:reb_remove_by_hash; 150, call; 151, call; 152, identifier:keepSorted; 153, identifier:clibrebound; 154, identifier:reb_remove_by_hash; 155, call; 156, identifier:hash; 157, identifier:keepSorted; 158, identifier:self; 159, identifier:hash; 160, identifier:byref; 161, argument_list; 162, identifier:c_uint32; 163, argument_list; 164, identifier:byref; 165, argument_list; 166, identifier:self; 167, identifier:hash; 168, identifier:self
code: def remove(self, index=None, hash=None, keepSorted=True):
          """ 
          Removes a particle from the simulation.
  
          Parameters
          ----------
          index : int, optional
              Specify particle to remove by index.
          hash : c_uint32 or string, optional
              Specifiy particle to remove by hash (if a string is passed, the corresponding hash is calculated).
          keepSorted : bool, optional
              By default, remove preserves the order of particles in the particles array. 
              Might set it to zero in cases with many particles and many removals to speed things up.
          """
          if index is not None:
              clibrebound.reb_remove(byref(self), index, keepSorted)
          if hash is not None:
              hash_types = c_uint32, c_uint, c_ulong
              PY3 = sys.version_info[0] == 3
              if PY3:
                  string_types = str,
                  int_types = int,
              else:
                  string_types = basestring,
                  int_types = int, long
              if isinstance(hash, string_types):
                  clibrebound.reb_remove_by_hash(byref(self), rebhash(hash), keepSorted)
              elif isinstance(hash, int_types):
                  clibrebound.reb_remove_by_hash(byref(self), c_uint32(hash), keepSorted)
              elif isinstance(hash, hash_types):
                  clibrebound.reb_remove_by_hash(byref(self), hash, keepSorted)
          if hasattr(self, '_widgets'):
              self._display_heartbeat(pointer(self))
  
          self.process_messages()