def _get_array(data, position, obj_end, opts, element_name):
 size = _UNPACK_INT(data[position:(position + 4)])[0]
 end = ((position + size) - 1)
 if (data[end:(end + 1)] != '\x00'):
  raise InvalidBSON('bad eoo')
 position += 4
 end -= 1
 result = []
 append = result.append
 index = data.index
 getter = _ELEMENT_GETTER
 while (position < end):
  element_type = data[position:(position + 1)]
  position = (index('\x00', position) + 1)
  try:
   (value, position) = getter[element_type](data, position, obj_end, opts, element_name)
  except KeyError:
   _raise_unknown_type(element_type, element_name)
  append(value)
 if (position != (end + 1)):
  raise InvalidBSON('bad array length')
 return (result, (position + 1))

def _get_array ( data , position , obj_end , opts , element_name ) : size = _UNPACK_INT ( data [ position : ( position + 4 ) ] ) [ 0 ] end = ( ( position + size ) - 1 ) if ( data [ end : ( end + 1 ) ] != '\x00' ) : raise InvalidBSON ( 'bad eoo' ) position += 4 end -= 1 result = [ ] append = result . append index = data . index getter = _ELEMENT_GETTER while ( position < end ) : element_type = data [ position : ( position + 1 ) ] position = ( index ( '\x00' , position ) + 1 ) try : ( value , position ) = getter [ element_type ] ( data , position , obj_end , opts , element_name ) except KeyError : _raise_unknown_type ( element_type , element_name ) append ( value ) if ( position != ( end + 1 ) ) : raise InvalidBSON ( 'bad array length' ) return ( result , ( position + 1 ) )
decode a bson array to python list .