class_docstr: Abstract base class for PennyLane devices.
  
  Args:
      wires (int or Iterable[Number, str]]): Number of subsystems represented by the device,
          or iterable that contains unique labels for the subsystems as numbers (i.e., ``[-1, 0, 2]``)
          or strings (``['ancilla', 'q1', 'q2']``). Default 1 if not specified.
      shots (int): Number of circuit evaluations/random samples used to estimate
          expectation values of observables. Defaults to 1000 if not specified.
class_docstr_tok: ["Abstract","base","class","for","PennyLane","devices",".","Args",":","wires","(","int","or","Iterable","[","Number",",","str","]","]",")",":","Number","of","subsystems","represented","by","the","device",",","or","iterable","that","contains","unique","labels","for","the","subsystems","as","numbers","(","i.e.",",","``","[","-1",",","0",",","2","]","``",")","or","strings","(","``","[","'ancilla","'",",","'q1","'",",","'q2","'","]","``",")",".","Default","1","if","not","specified",".","shots","(","int",")",":","Number","of","circuit","evaluations\/random","samples","used","to","estimate","expectation","values","of","observables",".","Defaults","to","1000","if","not","specified","."]
docstr: Method for expanding or decomposing an input circuit.
  Can be the default or a custom expansion method, see
  :meth:`.Device.default_expand_fn` and :meth:`.Device.custom_expand` for more
  details.
  
  Args:
      circuit (.QuantumTape): the circuit to expand.
      max_expansion (int): The number of times the circuit should be
          expanded. Expansion occurs when an operation or measurement is not
          supported, and results in a gate decomposition. If any operations
          in the decomposition remain unsupported by the device, another
          expansion occurs.
  
  Returns:
      .QuantumTape: The expanded/decomposed circuit, such that the device
      will natively support all operations.
docstr_tok: ["Method","for","expanding","or","decomposing","an","input","circuit",".","Can","be","the","default","or","a","custom","expansion","method",",","see",":","meth",":","`",".Device.default_expand_fn","`","and",":","meth",":","`",".Device.custom_expand","`","for","more","details",".","Args",":","circuit","(",".QuantumTape",")",":","the","circuit","to","expand",".","max_expansion","(","int",")",":","The","number","of","times","the","circuit","should","be","expanded",".","Expansion","occurs","when","an","operation","or","measurement","is","not","supported",",","and","results","in","a","gate","decomposition",".","If","any","operations","in","the","decomposition","remain","unsupported","by","the","device",",","another","expansion","occurs",".","Returns",":",".QuantumTape",":","The","expanded\/decomposed","circuit",",","such","that","the","device","will","natively","support","all","operations","."]
code: def expand_fn(self, circuit, max_expansion=10):
      """Method for expanding or decomposing an input circuit.
      Can be the default or a custom expansion method, see
      :meth:`.Device.default_expand_fn` and :meth:`.Device.custom_expand` for more
      details.
  
      Args:
          circuit (.QuantumTape): the circuit to expand.
          max_expansion (int): The number of times the circuit should be
              expanded. Expansion occurs when an operation or measurement is not
              supported, and results in a gate decomposition. If any operations
              in the decomposition remain unsupported by the device, another
              expansion occurs.
  
      Returns:
          .QuantumTape: The expanded/decomposed circuit, such that the device
          will natively support all operations.
      """
      if self.custom_expand_fn is not None:
          # pylint:disable=not-callable
          return self.custom_expand_fn(
              circuit, max_expansion=max_expansion
          )
  
      return self.default_expand_fn(
          circuit, max_expansion=max_expansion
      )
  
imports: import abc
  import copy
  import types
  import warnings
  from collections import OrderedDict
  from collections.abc import Iterable, Sequence
  from functools import lru_cache
  import numpy
  import pennylane
  from pennylane.measurements import MeasurementProcess, CountsMP, Expectation, ExpectationMP, MidMeasureMP, Probability, ProbabilityMP, Sample, SampleMP, ShadowExpvalMP, State, Variance
  from pennylane.operation import Observable, Operation, Tensor, Operator, StatePrepBase
  from pennylane.ops import Hamiltonian, Sum
  from pennylane.tape import QuantumScript, QuantumTape, expand_tape_state_prep
  from pennylane.wires import WireError, Wires
  from pennylane.queuing import QueuingManager
label_desc: Use image node_id 30 for calling the Device obj's underlying member method code with example usage: obj.expand_fn(circuit, max_expansion) and returns: self, self