def get_os(detailed=False):
try:<EOL><INDENT>os_type = platform.system()<EOL>if os_type == '<STR_LIT>':<EOL><INDENT>os_detail = platform.uname()<EOL>distribution = platform.linux_distribution()<EOL>HOME = os.environ['<STR_LIT>']<EOL>username = os.getenv('<STR_LIT>')<EOL><DEDENT>elif os_type == '<STR_LIT>':<EOL><INDENT>username = os.getenv('<STR_LIT:username>')<EOL>HOME = '<STR_LIT>' + username<EOL><DEDENT>elif os_type == '<STR_LIT>':<EOL><INDENT>logger.warning('<STR_LIT>')<EOL><DEDENT><DEDENT>except OSError as e:<EOL><INDENT>raise e<EOL><DEDENT>except Exception as e:<EOL><INDENT>logger.exception(<EOL>'<STR_LIT>' %<EOL>(inspect.stack()[<NUM_LIT:0>][<NUM_LIT:3>], str(e))<EOL>)<EOL><DEDENT>if detailed and os_type == '<STR_LIT>':<EOL><INDENT>return {<EOL>'<STR_LIT>': os_type,<EOL>'<STR_LIT>': os_detail,<EOL>'<STR_LIT>': distribution,<EOL>'<STR_LIT>': HOME<EOL>}<EOL><DEDENT>elif detailed and os_type == '<STR_LIT>':<EOL><INDENT>return {<EOL>'<STR_LIT>': os_type,<EOL>'<STR_LIT>': platform,<EOL>'<STR_LIT>': HOME<EOL>}<EOL><DEDENT>elif not detailed:<EOL><INDENT>return {'<STR_LIT>': os_type}<EOL><DEDENT>
Summary:
    Retrieve local operating system environment characteristics
Args:
    :user (str): USERNAME, only required when run on windows os
Returns:
    TYPE: dict object containing key, value pairs describing
    os information