def METHOD_NAME(self, metadata=None, cwd=None, **options):
    if metadata is None:
        metadata = {}
    if cwd is not None:
        old_dir = os.getcwd()
        os.chdir(cwd)
    pkg_info, dist = self.create_dist(**metadata)
    cmd = check(dist)
    cmd.initialize_options()
    for name, value in options.items():
        setattr(cmd, name, value)
    cmd.ensure_finalized()
    cmd.run()
    if cwd is not None:
        os.chdir(old_dir)
    return cmd