This function handles all the action: splunk calls this modular input
        without arguments, streams XML describing the inputs to stdin, and waits
        for XML on stdout describing events.

        If you set use_single_instance to True on the scheme in get_scheme, it
        will pass all the instances of this input to a single instance of this
        script.

        :param inputs: an InputDefinition object
        :param ew: an EventWriter object

def stream_events(self, inputs, ew):
        """This function handles all the action: splunk calls this modular input
        without arguments, streams XML describing the inputs to stdin, and waits
        for XML on stdout describing events.

        If you set use_single_instance to True on the scheme in get_scheme, it
        will pass all the instances of this input to a single instance of this
        script.

        :param inputs: an InputDefinition object
        :param ew: an EventWriter object
        """
        # Go through each input for this modular input
        for input_name, input_item in six.iteritems(inputs.inputs):
            # Get fields from the InputDefinition object
            owner = input_item["owner"]
            repo_name = input_item["repo_name"]

            # Get the fork count from the Github API
            repo_url = "https://api.github.com/repos/%s/%s" % (owner, repo_name)
            response = urllib2.urlopen(repo_url).read()
            jsondata = json.loads(response)
            fork_count = jsondata["forks_count"]

            # Create an Event object, and set its fields
            event = Event()
            event.stanza = input_name
            event.data = 'owner="%s" repository="%s" fork_count=%s' % \
                         (owner.replace('"', '\\"'), repo_name.replace('"', '\\"'), fork_count)

            # Tell the EventWriter to write this event
            ew.write_event(event)