code: def random_peak_magnitudes(
          log,
          peakMagnitudeDistributions,
          snTypesArray,
          plot=True):
      
      ################ > IMPORTS ################
      ## STANDARD LIB ##
      ## THIRD PARTY ##
      import matplotlib.pyplot as plt
      import numpy as np
      ## LOCAL APPLICATION ##
  
      ################ >ACTION(S) ################
      magDistributions = {}
      for snType, peakMag in peakMagnitudeDistributions['magnitude'].iteritems():
          sigma = peakMagnitudeDistributions['sigma'][snType]
          magDistributions[snType] = [peakMag, sigma]
  
      peakMagList = []
      for item in snTypesArray:
          thisPeak = magDistributions[item][
              1] * np.random.randn() + magDistributions[item][0]
          peakMagList.append(thisPeak)
  
      peakMagArray = np.array(peakMagList)
      # log.debug('peakMagArray %s' % (peakMagArray,))
  
      return peakMagArray
docs: *Generate a numpy array of random (distribution weighted) peak magnitudes for the given sn types.*
  
      **Key Arguments:**
          - ``log`` -- logger
          - ``peakMagnitudeDistributions`` -- yaml style dictionary of peak magnitude distributions
          - ``snTypesArray`` -- the pre-generated array of random sn types
          - ``plot`` -- generate plot?
  
      **Return:**
          - None