def findMedianSortedArrays(self, nums1, nums2):
    '\n        :type nums1: List[int]\n        :type nums2: List[int]\n        :rtype: float\n        '
    m = len(nums1)
    n = len(nums2)

    def find_kth(nums1, nums2, index1, index2, k):
        if (index1 >= len(nums1)):
            return nums2[((index2 + k) - 1)]
        if (index2 >= len(nums2)):
            return nums1[((index1 + k) - 1)]
        if (k == 1):
            return (nums1[index1] if (nums1[index1] < nums2[index2]) else nums2[index2])
        do_discard_nums1 = True
        mid = ((k // 2) - 1)
        if (((index1 + mid) >= len(nums1)) or (((index2 + mid) < len(nums2)) and (nums1[(index1 + mid)] > nums2[(index2 + mid)]))):
            do_discard_nums1 = False
        mid += 1
        if do_discard_nums1:
            return find_kth(nums1, nums2, (index1 + mid), index2, (k - mid))
        else:
            return find_kth(nums1, nums2, index1, (index2 + mid), (k - mid))
    return ((find_kth(nums1, nums2, 0, 0, (((m + n) + 1) // 2)) + find_kth(nums1, nums2, 0, 0, (((m + n) + 2) // 2))) / 2.0)
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
def findMedianSortedArrays(self, nums1, nums2):
    '\n        :type nums1: List[int]\n        :type nums2: List[int]\n        :rtype: float\n        '
    m = len(nums1)
    n = len(nums2)

    def find_kth(nums1, nums2, index1, index2, k):
        if (index1 >= len(nums1)):
            return nums2[((index2 + k) - 1)]
        if (index2 >= len(nums2)):
            return nums1[((index1 + k) - 1)]
        if (k == 1):
            return (nums1[index1] if (nums1[index1] < nums2[index2]) else nums2[index2])
        do_discard_nums1 = True
        mid = ((k // 2) - 1)
        if (((index1 + mid) >= len(nums1)) or (((index2 + mid) < len(nums2)) and (nums1[(index1 + mid)] > nums2[(index2 + mid)]))):
            do_discard_nums1 = False
        mid += 1
        if do_discard_nums1:
            return find_kth(nums1, nums2, (index1 + mid), index2, (k - mid))
        else:
            return find_kth(nums1, nums2, index1, (index2 + mid), (k - mid))
    return ((find_kth(nums1, nums2, 0, 0, (((m + n) + 1) // 2)) + find_kth(nums1, nums2, 0, 0, (((m + n) + 2) // 2))) / 2.0)