def share_with_invite(self, recipients, require_sign_in=True,<EOL>send_email=True, message=None, share_type='<STR_LIT>'):
if not self.object_id:<EOL><INDENT>return None<EOL><DEDENT>to = []<EOL>if recipients is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>elif isinstance(recipients, (list, tuple)):<EOL><INDENT>for x in recipients:<EOL><INDENT>if isinstance(x, str):<EOL><INDENT>to.append({'<STR_LIT:email>': x})<EOL><DEDENT>elif isinstance(x, Contact):<EOL><INDENT>to.append({'<STR_LIT:email>': x.main_email})<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(recipients, str):<EOL><INDENT>to.append({'<STR_LIT:email>': recipients})<EOL><DEDENT>elif isinstance(recipients, Contact):<EOL><INDENT>to.append({'<STR_LIT:email>': recipients.main_email})<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>')<EOL><DEDENT>url = self.build_url(<EOL>self._endpoints.get('<STR_LIT>').format(id=self.object_id))<EOL>data = {<EOL>'<STR_LIT>': to,<EOL>self._cc('<STR_LIT>'): require_sign_in,<EOL>self._cc('<STR_LIT>'): send_email,<EOL>}<EOL>if share_type in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>data['<STR_LIT>'] = ['<STR_LIT>']<EOL><DEDENT>elif share_type == {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>data['<STR_LIT>'] = ['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(share_type))<EOL><DEDENT>if send_email and message:<EOL><INDENT>data['<STR_LIT:message>'] = message<EOL><DEDENT>response = self.con.post(url, data=data)<EOL>if not response:<EOL><INDENT>return None<EOL><DEDENT>data = response.json()<EOL>return DriveItemPermission(parent=self, **{self._cloud_data_key: data})<EOL>
Sends an invitation to access or edit this DriveItem

        :param recipients: a string or Contact or a list of the former
         representing recipients of this invitation
        :type recipients: list[str] or list[Contact] or str or Contact
        :param bool require_sign_in: if True the recipients
         invited will need to log in to view the contents
        :param bool send_email: if True an email will be send to the recipients
        :param str message: the body text of the message emailed
        :param str share_type: 'view': will allow to read the contents.
         'edit' will allow to modify the contents
        :return: link to share
        :rtype: DriveItemPermission