code: def _fix_perms(perm_obj):
      
      ret_perm = perm_obj | stat.S_IROTH | stat.S_IRGRP | stat.S_IRUSR
      if ret_perm & stat.S_IXUSR:
          ret_perm = ret_perm | stat.S_IXGRP | stat.S_IXOTH
  
      return ret_perm
docs: :param perm_obj: A permissions object, as given by os.stat()
      :type perm_obj: integer
      :returns: A permissions object that is the result of "chmod a+rX" on the
                given permission object.  This is defined to be the permission object
                bitwise or-ed with all stat.S_IR*, and if the stat.S_IXUSR bit is
                set, then the permission object should also be returned bitwise or-ed
                with stat.S_IX* (stat.S_IXUSR not included because it would be redundant).
      :rtype: integer