<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_swagger_version(obj):
 """ get swagger version from loaded json """


    if isinstance(obj, dict):
        if 'swaggerVersion' in obj:
            return obj['swaggerVersion']
        elif 'swagger' in obj:
            return obj['swagger']
        return None
    else:
        # should be an instance of BaseObj
        return obj.swaggerVersion if hasattr(obj, 'swaggerVersion') else obj.swagger