docstr: Convert a precision string (e.g. "ap_fixed<16,6>" to the internal FixedPrecisionTypes etc)
docstr_tok: ["Convert","a","precision","string","(","e.g",".","``","ap_fixed","<","16,6",">","''","to","the","internal","FixedPrecisionTypes","etc",")"]
code: def _convert_ap_type(cls, precision):
      """
      Convert a precision string (e.g. "ap_fixed<16,6>" to the internal FixedPrecisionTypes etc)
      """
      bits = re.search(".+<(.+?)>", precision).group(1).split(",")
      sat_mode = None
      round_mode = None
      sat_bits = None
      if "fixed" in precision:
          width = int(bits[0])
          integer = int(bits[1])
          fields = 2
          signed = not ("u" in precision)
      elif "int" in precision:
          width = int(bits[0])
          integer = width
          fields = 1
          signed = not ("u" in precision)
      if len(bits) > fields:
          round_mode = bits[fields]
      if len(bits) > fields + 1:
          sat_mode = bits[fields + 1]
      if len(bits) > fields + 2:
          sat_bits = int(bits[fields + 2])
      if "fixed" in precision:
          return FixedPrecisionType(
              width, integer, signed, round_mode, sat_mode, sat_bits
          )
      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 14 for calling the FPGABackend obj's underlying member method code with example usage: obj._convert_ap_type(cls, precision) and returns: FixedPrecisionType, IntegerPrecisionType