def parse_player_definition(definition):
  """Parses player definition.

  An example of player definition is: "agent:players=4" or "replay:path=...".

  Args:
    definition: a string defining a player

  Returns:
    A tuple (name, dict).
  """
  name = definition

  d = {'left_players': 0,
       'right_players': 0}
  if ':' in definition:
    (name, params) = definition.split(':')
    for param in params.split(','):
      (key, value) = param.split('=')
      d[key] = value
  if d['left_players'] == 0 and d['right_players'] == 0:
    d['left_players'] = 1
  return name, d