input: Write a python function to create a new user and associated data in a Django application.
  assert create_user_and_data('John Doe', 'john@example.com', 'Sample data') == 'User and data created successfully'
  assert create_user_and_data('Jane Smith', 'jane@example.com', 'Another sample data') == 'User and data created successfully'
  assert create_user_and_data('Alice Brown', 'alice@example.com', '') == 'User and data created successfully'
output: def create_user_and_data(name, email, data):
      from django.contrib.auth.models import User
      from myapp.models import UserData  # Assuming UserData is the model for associated data
      
      try:
          user = User.objects.create_user(username=email, email=email, first_name=name.split()[0], last_name=name.split()[-1])
          UserData.objects.create(user=user, data=data)
          return 'User and data created successfully'
      except Exception as e:
          return str(e)