<human>:  What is a good Python function to create custom action.
<bot>: Here is a Python function to create custom action

import argparse

def parse_custom_action(action):
  """
  Parse custom action
  """
  if action == 'up':
    return 0
  elif action == 'down':
    return 1
  elif action == 'left':
    return 2
  elif action == 'right':
    return 3
  elif action =='stop':
    return 4
  else:
    return -1

# Enter the action
action = 'up'

# Calling the function
print((parse_custom_action(action)))

#Example Output
# 0

#Remember to inspect code for bugs.