human
Here's a good function header given the following:
I wrote the below code

    M_SOF0 = chr(192)
    M_SOF1 = chr(193)
    M_SOF2 = chr(194)
    M_SOF3 = chr(195)
    M_SOF5 = chr(197)
    M_SOF6 = chr(198)
    M_SOF7 = chr(199)
    M_SOF9 = chr(201)
    M_SOF10 = chr(202)
    M_SOF11 = chr(203)
    M_SOF13 = chr(205)
    M_SOF14 = chr(206)
    M_SOF15 = chr(207)
    M_SOI = chr(216)
    M_EOI = chr(217)
    M_FF = chr(255)
    MARKERS = [M_SOF0, M_SOF1, M_SOF2, M_SOF3, M_SOF5, M_SOF6, M_SOF7, M_SOF9, M_SOF10, M_SOF11, M_SOF13, M_SOF14, M_SOF15]
    def get_length():
        b1 = fin.read(1)
        b2 = fin.read(1)
        return ((ord(b1) << 8) + ord(b2))
    def next_marker():
        while (fin.read(1) != M_FF):
            pass
        while True:
            result = fin.read(1)
            if (result != M_FF):
                return result
        raise Exception('Invalid    JPEG')
    if (not ((fin.read(1) == M_FF) and (fin.read(1) == M_SOI))):
        raise Exception('Invalid    Jpeg')
    while True:
        marker = next_marker()
        length = get_length()
        if (length < 2):
            raise Exception('Erroneous    JPEG    marker    length')
        if (marker in MARKERS):
            fin.read(1)
            image_height = get_length()
            image_width = get_length()
            return (image_width, image_height)
        fin.read((length - 2))
    raise Exception('Invalid    JPEG,    end    of    stream    reached')

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

def _get_jpg_dimensions(fin):