<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_rename_entry( step: 'projects.ProjectStep', insertion_index: int = None, stash_path: str = None ) -> typing.Union[None, STEP_RENAME]: """ Creates a STEP_RENAME for the given ProjectStep instance :param step: The ProjectStep instance for which the STEP_RENAME will be created :param insertion_index: An optional index where a step will be inserted as part of this renaming process. Allows files to be renamed prior to the insertion of the step to prevent conflicts. :param stash_path: :return: """


    project = step.project
    name = step.definition.name
    name_parts = naming.explode_filename(name, project.naming_scheme)
    index = project.index_of_step(name)
    name_index = index

    if insertion_index is not None and insertion_index <= index:
        # Adjusts indexing when renaming is for the purpose of
        # inserting a new step
        name_index += 1

    name_parts['index'] = name_index
    new_name = naming.assemble_filename(
        scheme=project.naming_scheme,
        **name_parts
    )

    if name == new_name:
        return None

    if not stash_path:
        fd, stash_path = tempfile.mkstemp(
            prefix='{}-{}--{}--'.format(step.reference_id, name, new_name)
        )
        os.close(fd)

    return STEP_RENAME(
        id=step.reference_id,
        index=index,
        old_name=name,
        new_name=new_name,
        old_path=step.source_path,
        stash_path=stash_path,
        new_path=os.path.join(step.project.source_directory, new_name)
    )