human
I wrote the below code

    if (len(image.get_shape()) != 3):
        raise ValueError('Image    should    be    3D    tensor')
    with tf.name_scope('ResizeToRange', values=[image, min_dimension]):
        image_shape = tf.shape(image)
        orig_height = tf.to_float(image_shape[0])
        orig_width = tf.to_float(image_shape[1])
        orig_min_dim = tf.minimum(orig_height, orig_width)
        min_dimension = tf.constant(min_dimension, dtype=tf.float32)
        large_scale_factor = (min_dimension / orig_min_dim)
        large_height = tf.to_int32(tf.round((orig_height * large_scale_factor)))
        large_width = tf.to_int32(tf.round((orig_width * large_scale_factor)))
        large_size = tf.stack([large_height, large_width])
        if max_dimension:
            orig_max_dim = tf.maximum(orig_height, orig_width)
            max_dimension = tf.constant(max_dimension, dtype=tf.float32)
            small_scale_factor = (max_dimension / orig_max_dim)
            small_height = tf.to_int32(tf.round((orig_height * small_scale_factor)))
            small_width = tf.to_int32(tf.round((orig_width * small_scale_factor)))
            small_size = tf.stack([small_height, small_width])
            new_size = tf.cond((tf.to_float(tf.reduce_max(large_size)) > max_dimension), (lambda : small_size), (lambda : large_size))
        else:
            new_size = large_size
        new_image = tf.image.resize_images(image, new_size, align_corners=align_corners)
        result = new_image
        if (masks is not None):
            num_instances = tf.shape(masks)[0]
            def resize_masks_branch():
                new_masks = tf.expand_dims(masks, 3)
                new_masks = tf.image.resize_nearest_neighbor(new_masks, new_size, align_corners=align_corners)
                new_masks = tf.squeeze(new_masks, axis=3)
                return new_masks
            def reshape_masks_branch():
                new_masks = tf.reshape(masks, [0, new_size[0], new_size[1]])
                return new_masks
            masks = tf.cond((num_instances >...

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def resize_to_range(image, masks=None, min_dimension=None, max_dimension=None, align_corners=False):