def construct(cls, faker, path_to_factories=None):
        """
        Create a new factory container.

        :param faker: A faker generator instance
        :type faker: faker.Generator

        :param path_to_factories: The path to factories
        :type path_to_factories: str

        :rtype: Factory
        """
        factory = faker.__class__()

        if path_to_factories is not None and os.path.isdir(path_to_factories):
            for filename in os.listdir(path_to_factories):
                if os.path.isfile(filename):
                    cls._resolve(path_to_factories, filename)

        return factory
Create a new factory container.

        :param faker: A faker generator instance
        :type faker: faker.Generator

        :param path_to_factories: The path to factories
        :type path_to_factories: str

        :rtype: Factory