human
I wrote the below code

    if (len(image.get_shape()) != 3):
        raise ValueError('Image    should    be    3D    tensor')
    with tf.name_scope('RandomCropToAspectRatio', values=[image]):
        image_shape = tf.shape(image)
        orig_height = image_shape[0]
        orig_width = image_shape[1]
        orig_aspect_ratio = (tf.to_float(orig_width) / tf.to_float(orig_height))
        new_aspect_ratio = tf.constant(aspect_ratio, dtype=tf.float32)
        def target_height_fn():
            return tf.to_int32(tf.round(((tf.to_float(orig_height) * orig_aspect_ratio) / new_aspect_ratio)))
        target_height = tf.cond((orig_aspect_ratio >= new_aspect_ratio), (lambda : orig_height), target_height_fn)
        def target_width_fn():
            return tf.to_int32(tf.round(((tf.to_float(orig_width) * new_aspect_ratio) / orig_aspect_ratio)))
        target_width = tf.cond((orig_aspect_ratio <= new_aspect_ratio), (lambda : orig_width), target_width_fn)
        offset_height = _random_integer(0, ((orig_height - target_height) + 1), seed)
        offset_width = _random_integer(0, ((orig_width - target_width) + 1), seed)
        new_image = tf.image.crop_to_bounding_box(image, offset_height, offset_width, target_height, target_width)
        im_box = tf.stack([(tf.to_float(offset_height) / tf.to_float(orig_height)), (tf.to_float(offset_width) / tf.to_float(orig_width)), (tf.to_float((offset_height + target_height)) / tf.to_float(orig_height)), (tf.to_float((offset_width + target_width)) / tf.to_float(orig_width))])
        boxlist = box_list.BoxList(boxes)
        boxlist.add_field('labels', labels)
        im_boxlist = box_list.BoxList(tf.expand_dims(im_box, 0))
        (overlapping_boxlist, keep_ids) = box_list_ops.prune_non_overlapping_boxes(boxlist, im_boxlist, overlap_thresh)
        new_labels = overlapping_boxlist.get_field('labels')
        new_boxlist = box_list_ops.change_coordinate_frame(overlapping_boxlist, im_box)
        new_boxlist = box_list_ops.clip_to_window(new_boxlist, tf.constant([0.0, 0.0, 1.0, 1.0], tf.float32))
...

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

def random_crop_to_aspect_ratio(image, boxes, labels, masks=None, keypoints=None, aspect_ratio=1.0, overlap_thresh=0.3, seed=None):