@classmethod<EOL><INDENT>def from_analysis_period(cls, analysis_period=None):<DEDENT>
if not analysis_period:<EOL><INDENT>return cls()<EOL><DEDENT>elif hasattr(analysis_period, '<STR_LIT>'):<EOL><INDENT>return analysis_period<EOL><DEDENT>elif isinstance(analysis_period, str):<EOL><INDENT>try:<EOL><INDENT>return cls.from_string(analysis_period)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(<EOL>analysis_period, e)<EOL>)<EOL><DEDENT><DEDENT>
Create and AnalysisPeriod from an analysis period.

        This method is useful to be called from inside Grasshopper or Dynamo