def split_host_and_port(host):
  """
  Splits a string into its host and port components

  :param host: a string matching the following patern: <host name | ip address>[:port]
  :return: a Dictionary containing 'host' and 'port' entries for the input value
  """

  if host is None:
    host_and_port = None
  else:
    host_and_port = {}
    parts = host.split(":")

    if parts is not None:
      length = len(parts)

      if length > 0:
        host_and_port['host'] = parts[0]

        if length > 1:
          host_and_port['port'] = int(parts[1])

  return host_and_port