docstr: Convert a precision string (e.g. "ac_fixed<16,6>" to the internal FixedPrecisionTypes etc)
docstr_tok: ["Convert","a","precision","string","(","e.g",".","``","ac_fixed","<","16,6",">","''","to","the","internal","FixedPrecisionTypes","etc",")"]
code: def _convert_ac_type(cls, precision):
      """
      Convert a precision string (e.g. "ac_fixed<16,6>" to the internal FixedPrecisionTypes etc)
      """
      bits = re.search(".+<(.+?)>", precision).group(1).split(",")
      signed = True  # default is signed
      sat_mode = None
      round_mode = None
      if "fixed" in precision:
          width = int(bits[0])
          integer = int(bits[1])
          fields = 2
          if len(bits) > 2:
              # only if the third argument is false or 0, set signed to False
              # (default is True)
              if bits[2].strip().lower() in ["false", "0"]:
                  signed = False
              fields = 3
      elif "int" in precision:
          width = int(bits[0])
          integer = width
          fields = 1
          if len(bits) > 1:
              # only if the second argument is false or 0, set signed to False
              # (default is True)
              if bits[1].strip().lower() in ["false", "0"]:
                  signed = False
              fields = 2
      if len(bits) > fields:
          round_mode = bits[fields]
      if len(bits) > fields + 1:
          sat_mode = bits[fields + 1]
      if "fixed" in precision:
          return FixedPrecisionType(
              width, integer, signed, round_mode, sat_mode
          )
      elif "int" in precision:
          return IntegerPrecisionType(width, signed)
  
imports: import math
  import os
  import re
  from bisect import bisect_left
  from collections.abc import Iterable
  import numpy
  from hls4ml.backends.backend import Backend
  from hls4ml.model.attributes import ChoiceAttribute, ConfigurableAttribute, TypeAttribute
  from hls4ml.model.layers import GRU, LSTM, Activation, BatchNormalization, Conv1D, Conv2D, Dense, Dot, Embedding, GarNet, GarNetStack, GlobalPooling1D, GlobalPooling2D, Pooling1D, Pooling2D, SeparableConv1D, SeparableConv2D, SimpleRNN, Softmax
  from hls4ml.model.optimizer import model_optimizer
  from hls4ml.model.types import ExponentPrecisionType, FixedPrecisionType, IntegerPrecisionType, RoundingMode, SaturationMode, XnorPrecisionType
  from hls4ml.writer import get_writer
label_desc: Use image node_id 15 for calling the FPGABackend obj's underlying member method code with example usage: obj._convert_ac_type(cls, precision) and returns: FixedPrecisionType, IntegerPrecisionType