def new_private_link(name, user, nodes, anonymous):
 key = str(uuid.uuid4()).replace('-', '')
 if name:
  name = strip_html(name)
  if ((name is None) or (not name.strip())):
   raise ValidationValueError('Invalid link name.')
 else:
  name = 'Shared project link'
 private_link = PrivateLink(key=key, name=name, creator=user, anonymous=anonymous)
 private_link.save()
 private_link.nodes.add(*nodes)
 private_link.save()
 return private_link

def new_private_link ( name , user , nodes , anonymous ) : key = str ( uuid . uuid4 ( ) ) . replace ( '-' , '' ) if name : name = strip_html ( name ) if ( ( name is None ) or ( not name . strip ( ) ) ) : raise ValidationValueError ( 'Invalid link name.' ) else : name = 'Shared project link' private_link = PrivateLink ( key = key , name = name , creator = user , anonymous = anonymous ) private_link . save ( ) private_link . nodes . add ( * nodes ) private_link . save ( ) return private_link
create a new private link .