import stat


def repr(flags: int) -> str:
  """ Returns a string representation of the access flags *flags*. """

  template = 'rwxrwxrwx'
  order = (stat.S_IRUSR, stat.S_IWUSR, stat.S_IXUSR,
           stat.S_IRGRP, stat.S_IWGRP, stat.S_IXGRP,
           stat.S_IROTH, stat.S_IWOTH, stat.S_IXOTH)
  return ''.join(template[i] if flags&x else '-' for i, x in enumerate(order))