<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def common_items_metrics(all_items, common_items):
 """ Calculates the percentage of common items for each project in each segment and calculates the mean and std of this percentage for each segment. """

    segments = common_items.index.unique()
    metrics = {}
    for seg in segments:
        seg_common_items = segment_common_items(seg)
        projects = get_segment_projects(seg)

        metric_values = []

        for proj in projects:
            pronac = proj[0]
            percentage = common_items_percentage(pronac, seg_common_items)
            metric_values.append(percentage)

        metrics[seg] = {
            'mean': np.mean(metric_values),
            'std': np.std(metric_values)
        }
    return pd.DataFrame.from_dict(metrics, orient='index')