code: def from_analysis_period(cls, analysis_period=None):
          
          if not analysis_period:
              return cls()
          elif hasattr(analysis_period, 'isAnalysisPeriod'):
              return analysis_period
          elif isinstance(analysis_period, str):
              try:
                  return cls.from_string(analysis_period)
              except Exception as e:
                  raise ValueError(
                      "{} is not convertable to an AnalysisPeriod: {}".format(
                          analysis_period, e)
                  )
docs: Create and AnalysisPeriod from an analysis period.
  
          This method is useful to be called from inside Grasshopper or Dynamo