code: def compare_version(a, b):  # Ignore PyDocStyleBear
      
  
      def _range(q):
          """Convert a version string to array of integers.
  
          "1.2.3" -> [1, 2, 3]
  
          :param q: str
          :return: List[int]
          """
          r = []
          for n in q.replace("-", ".").split("."):
              try:
                  r.append(int(n))
              except ValueError:
                  # sort rc*, alpha, beta etc. lower than their non-annotated counterparts
                  r.append(-1)
          return r
  
      def _append_zeros(x, num_zeros):
          """Append `num_zeros` zeros to a copy of `x` and return it.
  
          :param x: List[int]
          :param num_zeros: int
          :return: List[int]
          """
          nx = list(x)
          for _ in range(num_zeros):
              nx.append(0)
          return nx
  
      def _cardinal(x, y):
          """Make both input lists be of same cardinality.
  
          :param x: List[int]
          :param y: List[int]
          :return: List[int]
          """
          lx, ly = len(x), len(y)
          if lx == ly:
              return x, y
          elif lx > ly:
              return x, _append_zeros(y, lx - ly)
          else:
              return _append_zeros(x, ly - lx), y
  
      left, right = _cardinal(_range(a), _range(b))
  
      return (left > right) - (left < right)
docs: Compare two version strings.
  
      :param a: str
      :param b: str
      :return: -1 / 0 / 1