def pick_orientation(img1, img2, spacing, desired_aspect=<NUM_LIT>):
w1, h1 = img1.size<EOL>w2, h2 = img2.size<EOL>size_a = (w1 + spacing + w2, max(h1, h2, <NUM_LIT:1>))<EOL>size_b = (max(w1, w2, <NUM_LIT:1>), h1 + spacing + h2)<EOL>aspect_a = size_a[<NUM_LIT:0>] / size_a[<NUM_LIT:1>]<EOL>aspect_b = size_b[<NUM_LIT:0>] / size_b[<NUM_LIT:1>]<EOL>goodness_a = min(desired_aspect, aspect_a) / max(desired_aspect, aspect_a)<EOL>goodness_b = min(desired_aspect, aspect_b) / max(desired_aspect, aspect_b)<EOL>return '<STR_LIT>' if goodness_a >= goodness_b else '<STR_LIT>'<EOL>
Pick a tiling orientation for two images.

    Returns either 'lr' for left-and-right, or 'tb' for top-and-bottom.

    Picks the one that makes the combined image have a better aspect
    ratio, where 'better' is defined as 'closer to 1:1.618'.