def _strip_rst_role(type_str):
 match = REST_ROLE_PATTERN.match(type_str)
 if match:
  return match.group(1)
 else:
  return type_str

def _strip_rst_role ( type_str ) : match = REST_ROLE_PATTERN . match ( type_str ) if match : return match . group ( 1 ) else : return type_str
strip off the part looks like a rest role in type_str .