Use the factories to create a host object.

    :param factories: a list of functions that return host objects
    (Hostname, IPv4Address, IPv6Address) for valid arguments
    :param value: a value to be passed as argument to factories
    :returns: an object representing the value, created by one of
    the factories.

    It is a return value of the first factory that could create it for
    the given argument.

    :raises InvalidHostError: if the value is not a valid input for any
    factory used by this function

def create_host(factories, value):
    """Use the factories to create a host object.

    :param factories: a list of functions that return host objects
    (Hostname, IPv4Address, IPv6Address) for valid arguments
    :param value: a value to be passed as argument to factories
    :returns: an object representing the value, created by one of
    the factories.

    It is a return value of the first factory that could create it for
    the given argument.

    :raises InvalidHostError: if the value is not a valid input for any
    factory used by this function
    """
    data = [value]
    for func in factories:
        try:
            return func(value)
        except InvalidHostError as ex:
            data.append(str(ex))
    msg_tpl = (
        "Failed to create a host object for '{}', raising the following errors"
        " in the process:" + "\n".join(data)
    )

    raise InvalidHostError(msg_tpl.format(value))