human
Solve the following python programming problem given the following code:
# Alternative ways to split include a split by time or by news event.
random.shuffle(labels_and_texts)

train_size = int(0.8 * len(labels_and_texts))

TRAIN_DATA = labels_and_texts[:train_size]
TEST_DATA = labels_and_texts[train_size:]

# Constants used to identify neighbor features in the input.
NBR_FEATURE_PREFIX = 'NL_nbr_'
NBR_WEIGHT_SUFFIX = '_weight'

def create_np_tensors_from_datum(datum, propagate_label=True):
  """Creates a node and neighbor numpy tensors given input datum.

  Args:
    datum: A dictionary with node and neighbor features and annotation label.
    propagate_label: Boolean indicating if we labels should be propagated to
    neighbors.

  Returns:
    A tuple T (node_tensor, neighbor_tensors) such that:
      T[0]: a dictionary containing node embeddings and label
      T[1]: a List of dictionaries, each containing embeddings for a
      neighbor and, if propagate_label is true, the corresponding label.

  """
  label_tensor =  datum['label']
  
  def get_float32_tensor(d):
    np_array = np.array(d, dtype='f')
    return np_array
    
  node_tensor = {
    'embedding' : get_float32_tensor(datum['source_embedding']),
    'label' : label_tensor
  }

  neighbor_tensors = []
  for re in datum['reaction_embedding']:
    tensor = {
      'embedding' : get_float32_tensor(re),
    }
    if propagate_label:
      tensor['label'] = label_tensor
    neighbor_tensors.append(dict(tensor))

  return node_tensor, neighbor_tensors

TRAIN_TENSORS = [
  create_np_tensors_from_datum(d) for d in TRAIN_DATA
]

TEST_TENSORS = [
  create_np_tensors_from_datum(d) for d in TEST_DATA
]

TRAIN_TENSORS[0][0], TEST_TENSORS[0][0]
Given the above code, generate some markdown instructions for it.
assistant
#Here is the Python code you requested.

Create train and test datasets
Using a 80:20 train:test split