code: def determine_position(position, img, mark):
      
      left = top = 0
  
      max_left = max(img.size[0] - mark.size[0], 0)
      max_top = max(img.size[1] - mark.size[1], 0)
  
      #Added a 10px margin from corners to apply watermark.
      margin = 10
  
      if not position:
          position = 'r'
  
      if isinstance(position, tuple):
          left, top = position
      elif isinstance(position, six.string_types):
          position = position.lower()
  
          # corner positioning
          if position in ['tl', 'tr', 'br', 'bl']:
              if 't' in position:
                  top = margin
              elif 'b' in position:
                  top = max_top - margin
              if 'l' in position:
                  left = margin
              elif 'r' in position:
                  left = max_left - margin
  
          # center positioning
          elif position == 'c':
              left = int(max_left / 2)
              top = int(max_top / 2)
  
          # random positioning
          elif position == 'r':
              left = random.randint(0, max_left)
              top = random.randint(0, max_top)
  
          # relative or absolute positioning
          elif 'x' in position:
              left, top = position.split('x')
  
              if '%' in left:
                  left = max_left * _percent(left)
              else:
                  left = _int(left)
  
              if '%' in top:
                  top = max_top * _percent(top)
              else:
                  top = _int(top)
  
      return int(left), int(top)
docs: Options:
          TL: top-left
          TR: top-right
          BR: bottom-right
          BL: bottom-left
          C: centered
          R: random
          X%xY%: relative positioning on both the X and Y axes
          X%xY: relative positioning on the X axis and absolute positioning on the
                Y axis
          XxY%: absolute positioning on the X axis and relative positioning on the
                Y axis
          XxY: absolute positioning on both the X and Y axes