code: def parse_size(size_raw):
      
      try:
          width_str, height_str = size_raw.lower().split('x')
      except AttributeError:
          size = None
      except ValueError:
          size = None
      else:
          try:
              width = int(width_str)
              assert width > 0
          except (ValueError, AssertionError):
              width = None
          try:
              height = int(height_str)
              assert height > 0
          except (ValueError, AssertionError):
              height = None
          size = width, height
          if not all(size):
              size = None
      return size
docs: Parse size URL parameter.
  
      >>> parse_size((100,None))
      None
      >>> parse_size('300x100')
      (300, 100)
      >>> parse_size('300x')
      None
      >>> parse_size('x100')
      None
      >>> parse_size('x')
      None