<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def series2df(Series, layer=2, split_sign = '_'):
 """expect pass a series that each row is string formated Json data with the same structure"""

    try:
        Series.columns
        Series = Series.iloc[:,0]
    except:
        pass
    
    def _helper(x, layer=2):
        try:
            return flatten_dict(ast.literal_eval(x), layers=layer, split_sign=split_sign)
        except:
            try:
                return flatten_dict(x, layers=layer, split_sign=split_sign)
            except:
                return x
    
    df=pd.DataFrame(Series.apply(_helper).tolist())
    
    return df