python beginner syntax question
<p>here's my code!</p>

<pre><code>import csv
import collections
import pdb

def do_work():
  (data,counter)=get_file('thefile.csv')
  b=samples_subset1(data,counter,'/pythonwork/samples_subset4.csv',1)
  medications_subset2(b,['BUPRENORPHINE'])

def write_file(data,filename):
  with open(filename,'wb') as outfile:
    writer=csv.writer(outfile)
    for row in data:
      writer.writerow(row)

def get_file(start_file):
  with open(start_file,'rb') as f:
    data=list(csv.reader(f))
    counter=collections.defaultdict(int)

    for row in data:
      counter[row[10]]+=1
  return (data,counter)

def samples_subset1(data,counter,output_file,sample_cutoff):
  b_counter=0
  b=[]
  for row in data:
    if counter[row[10]]&gt;=sample_cutoff:
      b.append(row) 
      b_counter+=1
  write_file(b,output_file)
  return b

def medications_subset2(b,drug_input):

  brand_names={'MORPHINE':['ASTRAMORPH','AVINZA','CONTIN','DURAMORPH','INFUMORPH',
                     'KADIAN','MS CONTIN','MSER','MSIR','ORAMORPH',
                     'ORAMORPH SR','ROXANOL','ROXANOL 100'],
         'OXYCODONE':['COMBUNOX','DIHYDRONE','DINARCON','ENDOCET','ENDODAN',
                      'EUBINE','EUCODAL','EUKODAL','EUTAGEN','OXYCODONE WITH ACETAMINOPHEN CAPSULES',
                      'OXYCODONE WITH ASPIRIN,','OXYCONTIN','OXYDOSE','OXYFAST','OXYIR',
                      'PANCODINE','PERCOCET','PERCODAN','PROLADONE','ROXICET',
                      'ROXICODONE','ROXIPRIM','ROXIPRIN','TECODIN','TEKODIN',
                      'THECODIN','THEKOKIN','TYLOX'],
         'OXYMORPHONE':['NUMORPHAN','OPANA','OPANA ER'],
         'METHADONE':['ALGIDON','ALGOLYSIN','AMIDON','DEPRIDOL','DOLOPHINE','FENADONE',
                      'METHADOSE','MIADONE','PHENADONE'],
         'BUPRENORPHINE':['BUPRENEX','LEPTAN','SUBOXONE','SUBUTEX','TEMGESIC'],
         'HYDROMORPHONE':['DILAUDID','HYDAL','HYDROMORFAN','HYDROMORPHAN','HYDROSTAT',
                          'HYMORPHAN','LAUDICON','NOVOLAUDON','OPIDOL','PALLADONE',
                          'PALLADONE IR','PALLADONE SR'],
         'CODEINE':['ACETAMINOPHEN WITH CODEINE','ASPIRIN WITH CODEINE','EMPIRIN WITH CODEINE',
                    'FLORINAL WITH CODEINE','TYLENOL 3','TYLENOL 4','TYLENOL 5'],
         'HYDROCODONE':['ANEXSIA','BEKADID','CO-GESIC','CODAL-DH','CODICLEAR-DH',
                        'CODIMAL-DH','CODINOVO','CONATUSSIN-DC','CYNDAL-HD','CYTUSS-HC',
                        'DETUSSIN','DICODID','DUODIN','DURATUSS-HD','ENDAL-HC','ENTUSS',
                        'ENTUSS-D','G-TUSS','HISTINEX-D','HISTINEX-HC','HISTUSSIN-D','HISTUSSIN-HC',
                        'HYCET','HYCODAN','HYCOMINE','HYDROCODONE/APAP','HYDROKON',
                        'HYDROMET','HYDROVO','KOLIKODOL','LORCET','LORTAB',
                        'MERCODINONE','NOROCO','NORGAN','NOVAHISTEX','ORTHOXYCOL',
                        'POLYGESIC','STAGESIC','SYMTAN','SYNKONIN','TUSSIONEX','VICODIN',
                        'VICOPROFEN','XODOL','ZYDONE']}

  #pdb.set_trace()
  c=[]
  done=False
  for row in b:
    done=False    
    for drug in drug_input:
      for brand in brand_names[drug]:    
        if row[1].upper().find(brand)!=-1:
          c.append(row)
          print row[1]
          done=True
          break
      if done:
        break

  write_file(c,'/pythonwork/medications_subset3.csv')
</code></pre>

<ol>
<li>are my indentations easy to read and in accordance with standards?</li>
<li>am i breaking up the code into usable functions in a clear, usable way?</li>
<li>can you give general criticism / advice on how to improve my syntax?</li>
</ol>

<p>thank you so much for your help</p>
