code: def share_file_with_user(self, path, user, **kwargs):
          remote_user = kwargs.get('remote_user', False)
          perms = kwargs.get('perms', self.OCS_PERMISSION_READ)
          if (((not isinstance(perms, int)) or (perms > self.OCS_PERMISSION_ALL))
                  or ((not isinstance(user, six.string_types)) or (user == ''))):
              return False
          if remote_user and (not user.endswith('/')):
              user = user + '/'
          path = self._normalize_path(path)
          post_data = {
              'shareType': self.OCS_SHARE_TYPE_REMOTE if remote_user else
              self.OCS_SHARE_TYPE_USER,
              'shareWith': user,
              'path': self._encode_string(path),
              'permissions': perms
          }
          res = self._make_ocs_request(
              'POST',
              self.OCS_SERVICE_SHARE,
              'shares',
              data=post_data
          )
          if self._debug:
              print('OCS share_file request for file %s with permissions %i '
                    'returned: %i' % (path, perms, res.status_code))
          if res.status_code == 200:
              tree = ET.fromstring(res.content)
              self._check_ocs_status(tree)
              data_el = tree.find('data')
              return ShareInfo(
                                  {
                                      'id': data_el.find('id').text,
                                      'path': path,
                                      'permissions': perms
                                  }
              )
          raise HTTPResponseError(res)