code: def _parse_device(s: str) -> Tuple[List[GridQubit], Dict[str, Set[GridQubit]]]:
      
      lines = s.strip().split('\n')
      qubits = []  # type: List[GridQubit]
      measurement_lines = {}  # type: Dict[str, Set[GridQubit]]
      for row, line in enumerate(lines):
          for col, c in enumerate(line.strip()):
              if c != '-':
                  qubit = GridQubit(row, col)
                  qubits.append(qubit)
                  measurement_line = measurement_lines.setdefault(c, set())
                  measurement_line.add(qubit)
      return qubits, measurement_lines
docs: Parse ASCIIart device layout into info about qubits and connectivity.
  
      Args:
          s: String representing the qubit layout. Each line represents a row,
              and each character in the row is a qubit, or a blank site if the
              character is a hyphen '-'. Different letters for the qubit specify
              which measurement line that qubit is connected to, e.g. all 'A'
              qubits share a measurement line. Leading and trailing spaces on
              each line are ignored.
  
      Returns:
          A list of qubits and a dict mapping measurement line name to the qubits
          on that measurement line.