code: def get_freq_code(freqstr: str) -> int:
      off = to_offset(freqstr, is_period=True)
      # error: "BaseOffset" has no attribute "_period_dtype_code"
      code = off._period_dtype_code  # type: ignore[attr-defined]
      return code
  
file_path: pandas/pandas/tests/tslibs/test_period.py
imports: import numpy
  import pytest
  from pandas._libs.tslibs import iNaT, to_offset
  from pandas._libs.tslibs.period import extract_ordinals, get_period_field_arr, period_asfreq, period_ordinal
  import pandas._testing
label_desc: Use image node_id 1 for calling a global function with example usage: get_freq_code(freqstr) and returns: code