def spritecollide(sprite, group, dokill, collided=None):
    """
    **pyj2d.sprite.spritecollide**
    
    Return list of sprites in group that intersect with sprite.
    The dokill argument is a bool, True removes sprites that collide from all groups.
    An optional collided is a callback function taking two sprites and return bool collision.
    """
    collide = []
    collision = False
    for _sprite in group:
        if sprite.rect.intersects(_sprite.rect):
            if collided:
                if not collided(sprite,_sprite):
                    continue
            collide.append(_sprite)
            collision = True
    if collision and dokill:
        for _sprite in collide:
            _sprite.kill()
    return collide