code: def SetPermissions(path, mode=None, uid=None, gid=None, mkdir=False):
    
    if mkdir and not os.path.exists(path):
      os.mkdir(path, mode or 0o777)
    elif mode:
      os.chmod(path, mode)
    if uid and gid:
      os.chown(path, uid, gid)
    _SetSELinuxContext(path)
docs: Set the permissions and ownership of a path.
  
    Args:
      path: string, the path for which owner ID and group ID needs to be setup.
      mode: octal string, the permissions to set on the path.
      uid: int, the owner ID to be set for the path.
      gid: int, the group ID to be set for the path.
      mkdir: bool, True if the directory needs to be created.