import time


def setup(camera, resolution=None):
    """Starts preview, sets resolution, sleep allows time for sensor warming"""

    camera.start_preview()
    if resolution:
        camera.resolution = (resolution)
    else:
        camera.resolution = (1640, 1232)
    time.sleep(3)
    return camera