def METHOD_NAME(lines, file_name=None, max_characters=1000000):
  # Parser for one or more cns sdb files.
  # Lines interpreted:
  #   {+ file: heavy_search_1.sdb +}
  #   sg= P6 a= 116.097 b= 116.097 c= 44.175 alpha= 90 beta= 90 gamma= 120
  #   {===>} site.action_1="refine";
  #   {===>} site.segid_1="SITE"; site.type_1="SE";
  #   {===>} site.x_1=18.7869; site.y_1=12.1257; site.z_1=0.163635;
  #   {===>} site.b_1=65.6408; site.q_1=1; site.g_1="";
  # Sites must be sorted.
  sdb_files = []
  block_name = None
  current_symmetry = None
  n_characters = 0
  p = 0
  for line in lines:
    if (max_characters != 0):
      n_characters += len(line)
      if (n_characters > max_characters): break
    m = re.search(r'\{\+\s+file:\s*(\S*)', line)
    if (m):
      block_name = m.group(1)
    m = re.match(re_sg_uc, line)
    if (m):
      current_symmetry = crystal_symmetry_from_re_match(m=m)
    m = re.search(
      r'\{\-\s+begin\s+block\s+parameter\s+definition\s+\-\}', line)
    if (m):
      if (block_name is None):
        i = len(sdb_files) + 1
        if (p): i += 1
        if (file_name is None):
          block_name = "block_%d" % i
        else:
          block_name = file_name + "_%d" % i
      if (p): sdb_files.append(p.as_sdb_sites())
      p = raw_parameters(block_name)
      if (current_symmetry is None):
        p.unit_cell = None
        p.space_group_info = None
      else:
        p.unit_cell = current_symmetry.unit_cell()
        p.space_group_info = current_symmetry.space_group_info()
        current_symmetry = None
      block_name = None
    if (not p): continue
    m = re.match(r'\{===>\}\s*sg=\s*"(\S+)"\s*;', line)
    if (m):
      p.space_group_info = sgtbx.space_group_info(m.group(1))
    p.add_action(re.search(r'site\.action_(\d+)\s*=\s*"([^"]*)"', line))
    p.add_segid(re.search(r'site\.segid_(\d+)\s*=\s*"([^"]*)"', line))
    p.add_type(re.search(r'site\.type_(\d+)\s*=\s*"([^"]*)"', line))
    p.add_x(re.search(r'site\.x_(\d+)\s*=\s*([^\s;]*)', line))
    p.add_y(re.search(r'site\.y_(\d+)\s*=\s*([^\s;]*)', line))
    p.add_z(re.search(r'site\.z_(\d+)\s*=\s*([^\s;]*)', line))
    p.add_b(re.search(r'site\.b_(\d+)\s*=\s*([^\s;]*)', line))
    p.add_q(re.search(r'site\.q_(\d+)\s*=\s*([^\s;]*)', line))
    p.add_g(re.search(r'site\.g_(\d+)\s*=\s*"([^"]*)"', line))
  if (p): sdb_files.append(p.as_sdb_sites())
  return sdb_files