nodes: 0, module; 1, function_definition; 2, function_name:get_key; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:key; 11, None; 12, identifier:keyfile; 13, None; 14, comment:""" returns a key given either its value, a path to it on the filesystem
      or as last resort it checks the environment variable CRYPTOYAML_SECRET
      """; 15, comparison_operator:key is None; 16, block; 17, identifier:key; 18, identifier:key; 19, None; 20, if_statement; 21, comparison_operator:keyfile is None; 22, block; 23, else_clause; 24, identifier:keyfile; 25, None; 26, expression_statement; 27, if_statement; 28, block; 29, assignment; 30, comparison_operator:key is None; 31, block; 32, else_clause; 33, expression_statement; 34, identifier:key; 35, call; 36, identifier:key; 37, None; 38, raise_statement; 39, block; 40, assignment; 41, attribute; 42, argument_list; 43, call; 44, expression_statement; 45, identifier:key; 46, call; 47, identifier:environ; 48, identifier:get; 49, string; 50, identifier:MissingKeyException; 51, argument_list; 52, assignment; 53, attribute; 54, argument_list; 55, string_content:CRYPTOYAML_SECRET; 56, concatenated_string; 57, identifier:key; 58, call; 59, call; 60, identifier:read; 61, string; 62, string; 63, string; 64, attribute; 65, argument_list; 66, identifier:open; 67, argument_list; 68, string_content:You must either provide a key value,; 69, string_content:a path to a key or its value via the environment variable; 70, string_content:CRYPTOYAML_SECRET; 71, identifier:key; 72, identifier:encode; 73, string; 74, identifier:keyfile; 75, string; 76, string_content:utf-8; 77, string_content:rb
code: def get_key(key=None, keyfile=None):
      """ returns a key given either its value, a path to it on the filesystem
      or as last resort it checks the environment variable CRYPTOYAML_SECRET
      """
      if key is None:
          if keyfile is None:
              key = environ.get('CRYPTOYAML_SECRET')
              if key is None:
                  raise MissingKeyException(
                      '''You must either provide a key value,'''
                      ''' a path to a key or its value via the environment variable '''
                      ''' CRYPTOYAML_SECRET'''
                  )
              else:
                  key = key.encode('utf-8')
          else:
              key = open(keyfile, 'rb').read()
      return key