input: Write a function to find the longest common substring between two given strings. If the strings are empty or there is no common substring, the function should return an empty string.
  
  def longest_substring(str_1, str_2):
      len_1 = len(str_1)
      len_2 = len(str_2)
      longest_substring = ''
      for x in range(len_1):
          for y in range(len_2):
              if str_1[x] == str_2[y]:
                  cur_substring = str_1[x]
                  while (x + 1 < len_1 and y + 1 < len_2 and
                         str_1[x + 1] == str_2[y + 1]):
                      cur_substring += str_1[x + 1]
                      x += 1
                      y += 1
                      if len(cur_substring) > len(longest_substring):
                          longest_substring = cur_substring
      return longest_substring
  
  assert longest_substring("abcdabcdabde", "defabcdabcd") == "abcdabcd"
  assert longest_substring("abc", "def") == ""
  assert longest_substring("", "def") == ""
  assert longest_substring("abc", "") == ""
  assert longest_substring("a", "a") == "a"
output: def longest_substring(str_1, str_2):
      len_1 = len(str_1)
      len_2 = len(str_2)
      longest_substring = ''
      for x in range(len_1):
          for y in range(len_2):
              if str_1[x] == str_2[y]:
                  cur_substring = str_1[x]
                  while (x + 1 < len_1 and y + 1 < len_2 and
                         str_1[x + 1] == str_2[y + 1]):
                      cur_substring += str_1[x + 1]
                      x += 1
                      y += 1
                      if len(cur_substring) > len(longest_substring):
                          longest_substring = cur_substring
      return longest_substring