<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_name(ctx, param, value):
 """Validate a project name."""

    if not value:
        value = os.path.basename(ctx.params['directory'].rstrip(os.path.sep))
    return value